diff options
author | Julius Bünger <buenger@mytum.de> | 2018-06-08 01:23:45 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-06-08 01:29:23 +0200 |
commit | 365e3bcae1e79c4f71f68e0d1d41172d86c51e76 (patch) | |
tree | 68afe344f0d3d4b8f59cb975a0837bc47f07f3f9 /src/rps/rps-test_util.c | |
parent | 4e2504a967ba09643c6dd7e3b9ce400e30adcb3d (diff) | |
download | gnunet-365e3bcae1e79c4f71f68e0d1d41172d86c51e76.tar.gz gnunet-365e3bcae1e79c4f71f68e0d1d41172d86c51e76.zip |
rps profiler: add correct make rule, util
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 | { |