Module Name:    src
Committed By:   christos
Date:           Sun Apr  4 00:08:49 UTC 2010

Modified Files:
        src/games/mille: save.c

Log Message:
handle ctime returning NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/mille/save.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/mille/save.c
diff -u src/games/mille/save.c:1.14 src/games/mille/save.c:1.15
--- src/games/mille/save.c:1.14	Mon May 25 19:24:54 2009
+++ src/games/mille/save.c	Sat Apr  3 20:08:49 2010
@@ -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 @@
 	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 @@
 rest_f(const char *file)
 {
 
-	char	*sp;
+	char	*sp, *p;
 	int	inf;
 	char	buf[80];
 	STAT	sbuf;
@@ -159,7 +163,10 @@
 	}
 	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';

Reply via email to