aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authoranryko <a.shvenke@gmail.com>2018-01-07 20:20:11 +0100
committeranryko <a.shvenke@gmail.com>2018-01-07 20:20:11 +0100
commit608c456a6849dadecab156657854f5335d86cb3d (patch)
tree59c70e6d02412c35b089bc017668f822faa55327 /src/nse
parent638642f8a3d750d77c501bcd565c05c2f98bbc2d (diff)
downloadgnunet-608c456a6849dadecab156657854f5335d86cb3d.tar.gz
gnunet-608c456a6849dadecab156657854f5335d86cb3d.zip
vsprintf returns negative on error.
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-nse-profiler.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index 4a10022e3..b665812e5 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -374,13 +374,14 @@ nse_disconnect_adapter (void *cls,
374 */ 374 */
375static int 375static int
376stat_iterator (void *cls, 376stat_iterator (void *cls,
377 const char *subsystem, 377 const char *subsystem,
378 const char *name, 378 const char *name,
379 uint64_t value, int is_persistent) 379 uint64_t value,
380 int is_persistent)
380{ 381{
381 char *output_buffer; 382 char *output_buffer;
382 struct GNUNET_TIME_Absolute now; 383 struct GNUNET_TIME_Absolute now;
383 size_t size; 384 int size;
384 unsigned int flag; 385 unsigned int flag;
385 386
386 GNUNET_assert (NULL != data_file); 387 GNUNET_assert (NULL != data_file);
@@ -390,8 +391,14 @@ stat_iterator (void *cls,
390 flag = 1; 391 flag = 1;
391 size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n", 392 size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n",
392 now.abs_value_us / 1000LL / 1000LL, 393 now.abs_value_us / 1000LL / 1000LL,
393 value, flag); 394 value, flag);
394 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) 395 if (0 > size)
396 {
397 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Error formatting output buffer.\n");
398 GNUNET_free (output_buffer);
399 return GNUNET_SYSERR;
400 }
401 if (size != GNUNET_DISK_file_write (data_file, output_buffer, (size_t) size))
395 { 402 {
396 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); 403 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
397 GNUNET_free (output_buffer); 404 GNUNET_free (output_buffer);