aboutsummaryrefslogtreecommitdiff
path: root/src/rps/rps-test_util.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-06-08 01:23:45 +0200
committerJulius Bünger <buenger@mytum.de>2018-06-08 01:29:23 +0200
commit365e3bcae1e79c4f71f68e0d1d41172d86c51e76 (patch)
tree68afe344f0d3d4b8f59cb975a0837bc47f07f3f9 /src/rps/rps-test_util.c
parent4e2504a967ba09643c6dd7e3b9ce400e30adcb3d (diff)
rps profiler: add correct make rule, util
Diffstat (limited to 'src/rps/rps-test_util.c')
-rw-r--r--src/rps/rps-test_util.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index 0c81cc2b42..ea55deac55 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -107,6 +107,53 @@ to_file_ (const char *file_name, char *line)
"Unable to close file\n");
}
+void
+to_file_raw (const char *file_name, void *buf, size_t size_buf)
+{
+ struct GNUNET_DISK_FileHandle *f;
+ size_t size2;
+
+
+ if (NULL == (f = GNUNET_DISK_file_open (file_name,
+ GNUNET_DISK_OPEN_APPEND |
+ GNUNET_DISK_OPEN_WRITE |
+ GNUNET_DISK_OPEN_CREATE,
+ GNUNET_DISK_PERM_USER_READ |
+ GNUNET_DISK_PERM_USER_WRITE |
+ GNUNET_DISK_PERM_GROUP_READ |
+ GNUNET_DISK_PERM_OTHER_READ)))
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Not able to open file %s\n",
+ file_name);
+ return;
+ }
+
+ size2 = GNUNET_DISK_file_write (f, buf, size_buf);
+ if (size_buf != size2)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Unable to write to file! (Size: %u, size2: %u)\n",
+ size_buf,
+ size2);
+
+ if (GNUNET_YES != GNUNET_DISK_file_close (f))
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Unable to close file\n");
+
+ return;
+ }
+
+ //if (512 < size_buf)
+ //{
+ // GNUNET_free (output_buffer_p);
+ //}
+
+ //if (GNUNET_YES != GNUNET_DISK_file_close (f))
+ // LOG (GNUNET_ERROR_TYPE_WARNING,
+ // "Unable to close file\n");
+}
+
char *
auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key)
{