comparison svr-session.c @ 618:b5cc8878d5ec

Properly fix the bug found years ago by Klocwork, refound again.
author Matt Johnston <matt@ucc.asn.au>
date Thu, 07 Apr 2011 13:33:26 +0000
parents a98a2138364a
children 0ad95abf8d3c
comparison
equal deleted inserted replaced
617:81def6b732c7 618:b5cc8878d5ec
203 struct tm * local_tm = NULL; 203 struct tm * local_tm = NULL;
204 timesec = time(NULL); 204 timesec = time(NULL);
205 local_tm = localtime(&timesec); 205 local_tm = localtime(&timesec);
206 if (local_tm == NULL 206 if (local_tm == NULL
207 || strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S", 207 || strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
208 localtime(&timesec)) == 0) 208 local_tm) == 0)
209 { 209 {
210 /* upon failure, just print the epoch-seconds time. */ 210 /* upon failure, just print the epoch-seconds time. */
211 snprintf(datestr, sizeof(datestr), "%d", (int)timesec); 211 snprintf(datestr, sizeof(datestr), "%d", (int)timesec);
212 } 212 }
213 fprintf(stderr, "[%d] %s %s\n", getpid(), datestr, printbuf); 213 fprintf(stderr, "[%d] %s %s\n", getpid(), datestr, printbuf);