summaryrefslogtreecommitdiff
path: root/src/rps/rps-test_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/rps-test_util.h')
-rw-r--r--src/rps/rps-test_util.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h
index 2e6560723..11093420e 100644
--- a/src/rps/rps-test_util.h
+++ b/src/rps/rps-test_util.h
@@ -29,9 +29,6 @@
#define TO_FILE 1
-void
-to_file_ (const char *file_name, char *line);
-
char *
auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key);
@@ -45,23 +42,33 @@ create_file (const char *name);
* This function is used to facilitate writing important information to disk
*/
#ifdef TO_FILE
-# define to_file(file_name, ...) do {char tmp_buf[512];\
+# define to_file(file_name, ...) do {char tmp_buf[512] = "";\
int size;\
size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\
if (0 > size)\
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
"Failed to create tmp_buf\n");\
else\
- to_file_(file_name,tmp_buf);\
+ GNUNET_DISK_fn_write(file_name,tmp_buf, sizeof(tmp_buf),\
+ GNUNET_DISK_PERM_USER_READ |\
+ GNUNET_DISK_PERM_USER_WRITE |\
+ GNUNET_DISK_PERM_GROUP_READ |\
+ GNUNET_DISK_PERM_OTHER_READ);\
} while (0);
-# define to_file_w_len(file_name, len, ...) do {char tmp_buf[len];\
+
+#define to_file_w_len(file_name, len, ...) do {char tmp_buf[len];\
int size;\
+ memset (tmp_buf, 0, len);\
size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\
if (0 > size)\
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
"Failed to create tmp_buf\n");\
else\
- to_file_(file_name,tmp_buf);\
+ GNUNET_DISK_fn_write(file_name,tmp_buf, len, \
+ GNUNET_DISK_PERM_USER_READ |\
+ GNUNET_DISK_PERM_USER_WRITE |\
+ GNUNET_DISK_PERM_GROUP_READ |\
+ GNUNET_DISK_PERM_OTHER_READ);\
} while (0);
#else /* TO_FILE */
# define to_file(file_name, ...)