diff options
Diffstat (limited to 'src/util/gnunet-ecc.c')
-rw-r--r-- | src/util/gnunet-ecc.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 66a4bd3e9..59a100a8c 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -281,8 +281,10 @@ print_key (const char *filename) | |||
281 | uint64_t fs; | 281 | uint64_t fs; |
282 | unsigned int total_hostkeys; | 282 | unsigned int total_hostkeys; |
283 | unsigned int c; | 283 | unsigned int c; |
284 | ssize_t sret; | ||
284 | 285 | ||
285 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) | 286 | if (GNUNET_YES != |
287 | GNUNET_DISK_file_test (filename)) | ||
286 | { | 288 | { |
287 | fprintf (stderr, | 289 | fprintf (stderr, |
288 | _("Hostkeys file `%s' not found\n"), | 290 | _("Hostkeys file `%s' not found\n"), |
@@ -291,7 +293,11 @@ print_key (const char *filename) | |||
291 | } | 293 | } |
292 | 294 | ||
293 | /* Check hostkey file size, read entire thing into memory */ | 295 | /* Check hostkey file size, read entire thing into memory */ |
294 | if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) | 296 | if (GNUNET_OK != |
297 | GNUNET_DISK_file_size (filename, | ||
298 | &fs, | ||
299 | GNUNET_YES, | ||
300 | GNUNET_YES)) | ||
295 | fs = 0; | 301 | fs = 0; |
296 | if (0 == fs) | 302 | if (0 == fs) |
297 | { | 303 | { |
@@ -307,15 +313,22 @@ print_key (const char *filename) | |||
307 | filename); | 313 | filename); |
308 | return; | 314 | return; |
309 | } | 315 | } |
310 | fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, | 316 | fd = GNUNET_DISK_file_open (filename, |
311 | GNUNET_DISK_PERM_NONE); | 317 | GNUNET_DISK_OPEN_READ, |
318 | GNUNET_DISK_PERM_NONE); | ||
312 | if (NULL == fd) | 319 | if (NULL == fd) |
313 | { | 320 | { |
314 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename); | 321 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, |
322 | "open", | ||
323 | filename); | ||
315 | return; | 324 | return; |
316 | } | 325 | } |
317 | hostkeys_data = GNUNET_malloc (fs); | 326 | hostkeys_data = GNUNET_malloc (fs); |
318 | if (fs != GNUNET_DISK_file_read (fd, hostkeys_data, fs)) | 327 | sret = GNUNET_DISK_file_read (fd, |
328 | hostkeys_data, | ||
329 | fs); | ||
330 | if ( (sret < 0) || | ||
331 | (fs != (size_t) sret) ) | ||
319 | { | 332 | { |
320 | fprintf (stderr, | 333 | fprintf (stderr, |
321 | _("Could not read hostkey file: %s\n"), | 334 | _("Could not read hostkey file: %s\n"), |
@@ -351,15 +364,21 @@ print_key (const char *filename) | |||
351 | /** | 364 | /** |
352 | * Main function that will be run by the scheduler. | 365 | * Main function that will be run by the scheduler. |
353 | * | 366 | * |
354 | * @param cls closure | 367 | * @param cls closure, NULL |
355 | * @param args remaining command-line arguments | 368 | * @param args remaining command-line arguments |
356 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 369 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
357 | * @param cfg configuration | 370 | * @param cfg configuration |
358 | */ | 371 | */ |
359 | static void | 372 | static void |
360 | run (void *cls, char *const *args, const char *cfgfile, | 373 | run (void *cls, |
374 | char *const *args, | ||
375 | const char *cfgfile, | ||
361 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 376 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
362 | { | 377 | { |
378 | (void) cls; | ||
379 | (void) cfgfile; | ||
380 | (void) cfg; | ||
381 | |||
363 | if (print_examples_flag) | 382 | if (print_examples_flag) |
364 | { | 383 | { |
365 | print_examples (); | 384 | print_examples (); |