* first check CC before accessing it. Save time by doing WCC like copy as CCC
authorWilfried Göesgens <willi@citadel.org>
Thu, 25 Jun 2009 12:45:23 +0000 (12:45 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 25 Jun 2009 12:45:23 +0000 (12:45 +0000)
citadel/sysdep.c

index 90b5e4517f2ce34860b8e9fd57994238627b894e..b1415a4aba393824a4ed735002c5d3314e92689d 100644 (file)
@@ -171,18 +171,19 @@ void vCtdlLogPrintf(enum LogLevel loglevel, const char *format, va_list arg_ptr)
                struct timeval tv;
                struct tm tim;
                time_t unixtime;
+               struct CitContext *CCC = CC;
 
                gettimeofday(&tv, NULL);
                /* Promote to time_t; types differ on some OSes (like darwin) */
                unixtime = tv.tv_sec;
                localtime_r(&unixtime, &tim);
-               if (CC->cs_pid != 0) {
+               if ((CCC != NULL) && (CCC->cs_pid != 0)) {
                        sprintf(buf,
                                "%04d/%02d/%02d %2d:%02d:%02d.%06ld [%3d] ",
                                tim.tm_year + 1900, tim.tm_mon + 1,
                                tim.tm_mday, tim.tm_hour, tim.tm_min,
                                tim.tm_sec, (long)tv.tv_usec,
-                               CC->cs_pid);
+                               CCC->cs_pid);
                } else {
                        sprintf(buf,
                                "%04d/%02d/%02d %2d:%02d:%02d.%06ld ",