Author: tjansen Date: Tue Oct 27 17:48:30 2009 New Revision: 1359 Log: Fixed several checks, if a logfile was specified. The main difference between 1. if (logfile == NULL) 2. if (logfile[0] == 0) is, that 1 is never true, as logfile is an array and can thus never be NULL. What was meant to be checked is if logfile is a valid filename. init_log sets logfile to "" if the file could not be opened and that is exactly what 2 checks for. Modified: trunk/libpisa/log.c Modified: trunk/libpisa/log.c ============================================================================== --- trunk/libpisa/log.c Tue Oct 27 17:40:54 2009 (r1358) +++ trunk/libpisa/log.c Tue Oct 27 17:48:30 2009 (r1359) @@ -65,7 +65,7 @@ char buffer[LENGTH_DATE_BUFFER]; char ip_buffer[INET_ADDRSTRLEN]; - if (logfile == NULL) + if (logfile[0] == 0) return; get_formatted_current_time(buffer, LENGTH_DATE_BUFFER, DATE_FORMAT); @@ -91,7 +91,7 @@ time_t rawtime; double dif; - if (logfile == NULL) + if (logfile[0] == 0) return; time(&rawtime); @@ -194,7 +194,7 @@ { char buffer[LENGTH_DATE_BUFFER]; - if (logfile == NULL) + if (logfile[0] == 0) return; get_formatted_current_time(buffer, LENGTH_DATE_BUFFER, DATE_FORMAT); @@ -320,7 +320,7 @@ va_list args; FILE *f; - if (logfile == NULL) + if (logfile[0] == 0) return; va_start(args, fmt);