diff options
Diffstat (limited to 'src/rps/rps-test_util.c')
-rw-r--r-- | src/rps/rps-test_util.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c index 0c81cc2b4..ea55deac5 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) | |||
107 | "Unable to close file\n"); | 107 | "Unable to close file\n"); |
108 | } | 108 | } |
109 | 109 | ||
110 | void | ||
111 | to_file_raw (const char *file_name, void *buf, size_t size_buf) | ||
112 | { | ||
113 | struct GNUNET_DISK_FileHandle *f; | ||
114 | size_t size2; | ||
115 | |||
116 | |||
117 | if (NULL == (f = GNUNET_DISK_file_open (file_name, | ||
118 | GNUNET_DISK_OPEN_APPEND | | ||
119 | GNUNET_DISK_OPEN_WRITE | | ||
120 | GNUNET_DISK_OPEN_CREATE, | ||
121 | GNUNET_DISK_PERM_USER_READ | | ||
122 | GNUNET_DISK_PERM_USER_WRITE | | ||
123 | GNUNET_DISK_PERM_GROUP_READ | | ||
124 | GNUNET_DISK_PERM_OTHER_READ))) | ||
125 | { | ||
126 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
127 | "Not able to open file %s\n", | ||
128 | file_name); | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | size2 = GNUNET_DISK_file_write (f, buf, size_buf); | ||
133 | if (size_buf != size2) | ||
134 | { | ||
135 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
136 | "Unable to write to file! (Size: %u, size2: %u)\n", | ||
137 | size_buf, | ||
138 | size2); | ||
139 | |||
140 | if (GNUNET_YES != GNUNET_DISK_file_close (f)) | ||
141 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
142 | "Unable to close file\n"); | ||
143 | |||
144 | return; | ||
145 | } | ||
146 | |||
147 | //if (512 < size_buf) | ||
148 | //{ | ||
149 | // GNUNET_free (output_buffer_p); | ||
150 | //} | ||
151 | |||
152 | //if (GNUNET_YES != GNUNET_DISK_file_close (f)) | ||
153 | // LOG (GNUNET_ERROR_TYPE_WARNING, | ||
154 | // "Unable to close file\n"); | ||
155 | } | ||
156 | |||
110 | char * | 157 | char * |
111 | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key) | 158 | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key) |
112 | { | 159 | { |