gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2829 - GNUnet/src/util


From: grothoff
Subject: [GNUnet-SVN] r2829 - GNUnet/src/util
Date: Mon, 15 May 2006 02:13:22 -0700 (PDT)

Author: grothoff
Date: 2006-05-15 02:13:18 -0700 (Mon, 15 May 2006)
New Revision: 2829

Modified:
   GNUnet/src/util/logging.c
Log:
fixing crash

Modified: GNUnet/src/util/logging.c
===================================================================
--- GNUnet/src/util/logging.c   2006-05-15 01:49:08 UTC (rev 2828)
+++ GNUnet/src/util/logging.c   2006-05-15 09:13:18 UTC (rev 2829)
@@ -414,7 +414,7 @@
 void LOG(LOG_Level minLogLevel,
         const char *format, ...) {
   va_list      args;
-  size_t len;
+  int len;
 
   if (loglevel__ < minLogLevel)
     return;
@@ -441,19 +441,21 @@
       FPRINTF(logfile, "%s:", gettext(loglevels[minLogLevel]));
     else
       FPRINTF(logfile, "%s: ", gettext(loglevels[minLogLevel]));
-    len = VFPRINTF(logfile, format, args);
+    len = VFPRINTF(logfile, format, args);     
     fflush(logfile);
   } else
     len = VFPRINTF(stderr, format, args);
   va_end(args);
   if (bInited)
     MUTEX_UNLOCK(&logMutex);
-  if (customLog) {
+  if ( (customLog) &&
+       (len >= 0) ) {
     char * txt;
 
     txt = MALLOC(len + 1);
     va_start(args, format);
-    GNUNET_ASSERT(len == VSNPRINTF(txt, len, format, args));
+    if (len != VSNPRINTF(txt, len, format, args))
+      BREAK();
     va_end(args);
     customLog(txt);
     FREE(txt);





reply via email to

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