gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: check strftime return value


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: check strftime return value
Date: Fri, 05 Jan 2018 17:27:35 +0100

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 7de0ac8e4 check strftime return value
7de0ac8e4 is described below

commit 7de0ac8e4675e875cb40c0a6d3e3df5191e01959
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Jan 5 17:27:32 2018 +0100

    check strftime return value
---
 src/util/common_logging.c | 54 +++++++++++++++++++++++++++++------------------
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 3e71fa476..ea5430191 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -976,20 +976,25 @@ mylog (enum GNUNET_ErrorType kind,
     }
     else
     {
-      strftime (date2,
-                DATE_STR_SIZE,
-                "%b %d %H:%M:%S-%%020llu",
-                tmptr);
-      snprintf (date,
-                sizeof (date),
-                date2,
-               (long long) (pc.QuadPart /
-                            (performance_frequency.QuadPart / 1000)));
+      if (0 ==
+         strftime (date2,
+                   DATE_STR_SIZE,
+                   "%b %d %H:%M:%S-%%020llu",
+                   tmptr))
+       abort ();
+      if (0 >
+         snprintf (date,
+                   sizeof (date),
+                   date2,
+                   (long long) (pc.QuadPart /
+                                (performance_frequency.QuadPart / 1000))))
+       abort ();
     }
 #else
     struct timeval timeofday;
 
-    gettimeofday (&timeofday, NULL);
+    gettimeofday (&timeofday,
+                 NULL);
     offset = GNUNET_TIME_get_offset ();
     if (offset > 0)
     {
@@ -1022,24 +1027,33 @@ mylog (enum GNUNET_ErrorType kind,
     }
     else
     {
-      strftime (date2,
-                DATE_STR_SIZE,
-                "%b %d %H:%M:%S-%%06u",
-                tmptr);
-      snprintf (date,
-                sizeof (date),
-                date2,
-                timeofday.tv_usec);
+      if (0 ==
+         strftime (date2,
+                   DATE_STR_SIZE,
+                   "%b %d %H:%M:%S-%%06u",
+                   tmptr))
+       abort ();
+      if (0 >
+         snprintf (date,
+                   sizeof (date),
+                   date2,
+                   timeofday.tv_usec))
+       abort ();
     }
 #endif
-    VSNPRINTF (buf, size, message, va);
+    VSNPRINTF (buf,
+              size,
+              message,
+              va);
 #if ! (defined(GNUNET_CULL_LOGGING) || TALER_WALLET_ONLY)
     if (NULL != tmptr)
       (void) setup_log_file (tmptr);
 #endif
     if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) &&
         (0 != last_bulk_time.abs_value_us) &&
-        (0 == strncmp (buf, last_bulk, sizeof (last_bulk))))
+        (0 == strncmp (buf,
+                      last_bulk,
+                      sizeof (last_bulk))))
     {
       last_bulk_repeat++;
       if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us >

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



reply via email to

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