Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/ls handle ctime returning NULL



details:   https://anonhg.NetBSD.org/src/rev/68acb8d1454b
branches:  trunk
changeset: 753564:68acb8d1454b
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 01 22:23:27 2010 +0000

description:
handle ctime returning NULL

diffstat:

 bin/ls/print.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 3d8cdfe06b8d -r 68acb8d1454b bin/ls/print.c
--- a/bin/ls/print.c    Thu Apr 01 18:59:27 2010 +0000
+++ b/bin/ls/print.c    Thu Apr 01 22:23:27 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print.c,v 1.45 2009/02/14 08:02:04 lukem Exp $ */
+/*     $NetBSD: print.c,v 1.46 2010/04/01 22:23:27 christos Exp $      */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)print.c    8.5 (Berkeley) 7/28/94";
 #else
-__RCSID("$NetBSD: print.c,v 1.45 2009/02/14 08:02:04 lukem Exp $");
+__RCSID("$NetBSD: print.c,v 1.46 2010/04/01 22:23:27 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -353,9 +353,13 @@
 printtime(time_t ftime)
 {
        int i;
-       char *longstring;
+       const char *longstring;
 
        longstring = ctime(&ftime);
+       if (longstring == NULL) {
+                          /* 012345678901234567890123 */
+               longstring = "????????????????????????";
+       }
        for (i = 4; i < 11; ++i)
                (void)putchar(longstring[i]);
 



Home | Main Index | Thread Index | Old Index