*/
/*
* file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.66 2005/03/06 05:58:22 christos Exp $
+ * @(#)$Id: file.h,v 1.67 2005/03/14 16:56:24 christos Exp $
*/
#ifndef __file_h__
};
struct stat;
-protected char *file_fmttime(uint32_t, int);
+protected const char *file_fmttime(uint32_t, int);
protected int file_buffer(struct magic_set *, int, const void *, size_t);
protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
#include <time.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: print.c,v 1.46 2004/11/13 08:11:39 christos Exp $")
+FILE_RCSID("@(#)$Id: print.c,v 1.47 2005/03/14 16:56:25 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
fputc('\n', stderr);
}
-protected char *
+protected const char *
file_fmttime(uint32_t v, int local)
{
char *pp, *rt;
struct tm *tm1;
(void)time(&now);
tm1 = localtime(&now);
+ if (tm1 == NULL)
+ return "*Invalid time*";
daylight = tm1->tm_isdst;
}
#endif /* HAVE_TM_ISDST */
if (daylight)
t += 3600;
tm = gmtime(&t);
+ if (tm == NULL)
+ return "*Invalid time*";
pp = asctime(tm);
}