summaryrefslogtreecommitdiffstats
path: root/mille
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2010-04-04 00:08:49 +0000
committerchristos <christos@NetBSD.org>2010-04-04 00:08:49 +0000
commit8c18ea25f25726d33a02c812356d98714c3b71ad (patch)
treef2d1489fef7ef70669f4c0aef24aa212c6018bd1 /mille
parenta53a36daca29fbcfba1da1f2e0c4f0c8e9cef879 (diff)
downloadbsdgames-darwin-8c18ea25f25726d33a02c812356d98714c3b71ad.tar.gz
bsdgames-darwin-8c18ea25f25726d33a02c812356d98714c3b71ad.tar.zst
bsdgames-darwin-8c18ea25f25726d33a02c812356d98714c3b71ad.zip
handle ctime returning NULL.
Diffstat (limited to 'mille')
-rw-r--r--mille/save.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/mille/save.c b/mille/save.c
index eff5c9a8..c9ae1967 100644
--- a/mille/save.c
+++ b/mille/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.14 2009/05/25 23:24:54 dholland Exp $ */
+/* $NetBSD: save.c,v 1.15 2010/04/04 00:08:49 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.14 2009/05/25 23:24:54 dholland Exp $");
+__RCSID("$NetBSD: save.c,v 1.15 2010/04/04 00:08:49 christos Exp $");
#endif
#endif /* not lint */
@@ -124,7 +124,11 @@ over:
if (rv == FALSE) {
unlink(buf);
} else {
- strcpy(buf, ctime(tp));
+ char *p;
+ if ((p = ctime(tp)) == NULL)
+ strcpy(buf, "?");
+ else
+ strcpy(buf, p);
for (sp = buf; *sp != '\n'; sp++)
continue;
*sp = '\0';
@@ -144,7 +148,7 @@ bool
rest_f(const char *file)
{
- char *sp;
+ char *sp, *p;
int inf;
char buf[80];
STAT sbuf;
@@ -159,7 +163,10 @@ rest_f(const char *file)
}
varpush(inf, readv);
close(inf);
- strcpy(buf, ctime(&sbuf.st_mtime));
+ if ((p = ctime(&sbuf.st_mtime)) == NULL)
+ strcpy(buf, "?");
+ else
+ strcpy(buf, p);
for (sp = buf; *sp != '\n'; sp++)
continue;
*sp = '\0';