gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: vsprintf returns negative o


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: vsprintf returns negative on error.
Date: Sun, 07 Jan 2018 20:20:21 +0100

This is an automated email from the git hooks/post-receive script.

arny pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 608c456a6 vsprintf returns negative on error.
608c456a6 is described below

commit 608c456a6849dadecab156657854f5335d86cb3d
Author: anryko <address@hidden>
AuthorDate: Sun Jan 7 20:20:11 2018 +0100

    vsprintf returns negative on error.
---
 src/nse/gnunet-nse-profiler.c | 19 +++++++++++++------
 src/util/common_allocation.c  |  4 ++--
 2 files changed, 15 insertions(+), 8 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,
  */
 static int
 stat_iterator (void *cls,
-              const char *subsystem,
-              const char *name,
-              uint64_t value, int is_persistent)
+               const char *subsystem,
+               const char *name,
+               uint64_t value,
+               int is_persistent)
 {
   char *output_buffer;
   struct GNUNET_TIME_Absolute now;
-  size_t size;
+  int size;
   unsigned int flag;
 
   GNUNET_assert (NULL != data_file);
@@ -390,8 +391,14 @@ stat_iterator (void *cls,
     flag = 1;
   size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n",
                           now.abs_value_us / 1000LL / 1000LL,
-                         value, flag);
-  if (size != GNUNET_DISK_file_write (data_file, output_buffer, size))
+                          value, flag);
+  if (0 > size)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Error formatting output 
buffer.\n");
+    GNUNET_free (output_buffer);
+    return GNUNET_SYSERR;
+  }
+  if (size != GNUNET_DISK_file_write (data_file, output_buffer, (size_t) size))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
     GNUNET_free (output_buffer);
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 80047bb52..1c55d72b5 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -475,8 +475,8 @@ GNUNET_xgrow_ (void **old,
  */
 int
 GNUNET_asprintf (char **buf,
-                const char *format,
-                ...)
+                 const char *format,
+                 ...)
 {
   int ret;
   va_list args;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]