diff options
author | Jeremy Allison <jra@samba.org> | 2006-06-14 21:36:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:17:26 -0500 |
commit | a1e0a0e9286fbe90ca04cda9df38e72d8d18b0c1 (patch) | |
tree | 14c15c8333572c5a2e089611ee61d03010a9d2b4 /source3/utils/net_time.c | |
parent | 2b99951e7511d0ec2d928c06b05fe22b7b6572d1 (diff) | |
download | samba-a1e0a0e9286fbe90ca04cda9df38e72d8d18b0c1.tar.gz |
r16230: Fix Klocwork #861 and others. localtime and asctime
can return NULL. Ensure we check all returns correctly.
Jeremy.
(This used to be commit 6c61dc8ed6d84f310ef391fb7700e93ef42c4afc)
Diffstat (limited to 'source3/utils/net_time.c')
-rw-r--r-- | source3/utils/net_time.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c index 1a7116d447d..f6486286a65 100644 --- a/source3/utils/net_time.c +++ b/source3/utils/net_time.c @@ -69,12 +69,15 @@ static time_t nettime(int *zone) } /* return a time as a string ready to be passed to /bin/date */ -static char *systime(time_t t) +static const char *systime(time_t t) { static fstring s; struct tm *tm; tm = localtime(&t); + if (!tm) { + return "unknown"; + } fstr_sprintf(s, "%02d%02d%02d%02d%04d.%02d", tm->tm_mon+1, tm->tm_mday, tm->tm_hour, |