[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r3693 - trunk/OpenDNSSEC/signer/src/util

Matthijs Mekking matthijs at nlnetlabs.nl
Tue Aug 10 10:52:43 CEST 2010


Author: matthijs
Date: 2010-08-10 10:52:43 +0200 (Tue, 10 Aug 2010)
New Revision: 3693

Modified:
   trunk/OpenDNSSEC/signer/src/util/log.c
Log:
ctime() can return NULL



Modified: trunk/OpenDNSSEC/signer/src/util/log.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/util/log.c	2010-08-10 08:43:54 UTC (rev 3692)
+++ trunk/OpenDNSSEC/signer/src/util/log.c	2010-08-10 08:52:43 UTC (rev 3693)
@@ -209,10 +209,15 @@
         return;
     }
     strtime = ctime(&now);
-    strtime[strlen(strtime)-1] = '\0';
+    if (strlen(strtime) > 1) {
+        strtime[strlen(strtime)-1] = '\0';
+        fprintf(logfile, "[%s] %s[%i] %s: %s\n", strtime,
+            PACKAGE_TARNAME, priority, t, message);
+    } else {
+        fprintf(logfile, "[%u] %s[%i] %s: %s\n", time(NULL),
+            PACKAGE_TARNAME, priority, t, message);
+    }
 
-    fprintf(logfile, "[%s] %s[%i] %s: %s\n", strtime,
-        PACKAGE_TARNAME, priority, t, message);
     fflush(logfile);
 }
 




More information about the Opendnssec-commits mailing list