correctly, this can happen if the time handed to it is before the UNIX
epoch. Just report "(Can't convert time)" if it returns a null pointer.
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.23 2002-08-06 04:42:07 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.24 2002-09-04 09:53:42 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
case 'T':
{
time_t t;
+ struct tm *lt;
+ char *tstring;
int x;
x = EXTRACT_LE_32BITS(buf);
buf += 8;
break;
}
- printf("%s", t ? asctime(localtime(&t)) : "NULL\n");
+ if (t != 0) {
+ lt = localtime(&t);
+ if (lt != NULL)
+ tstring = asctime(lt);
+ else
+ tstring = "(Can't convert time)\n";
+ } else
+ tstring = "NULL\n";
+ printf("%s", tstring);
fmt++;
while (isdigit((unsigned char)*fmt))
fmt++;