Module Name:    src
Committed By:   christos
Date:           Fri Apr  2 15:40:14 UTC 2010

Modified Files:
        src/dist/pppd/pppd: utils.c

Log Message:
handle ctime returning NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/dist/pppd/pppd/utils.c

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

Modified files:

Index: src/dist/pppd/pppd/utils.c
diff -u src/dist/pppd/pppd/utils.c:1.3 src/dist/pppd/pppd/utils.c:1.4
--- src/dist/pppd/pppd/utils.c:1.3	Sun Nov  5 04:16:20 2006
+++ src/dist/pppd/pppd/utils.c	Fri Apr  2 11:40:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: utils.c,v 1.3 2006/11/05 09:16:20 martin Exp $	*/
+/*	$NetBSD: utils.c,v 1.4 2010/04/02 15:40:14 christos Exp $	*/
 
 /*
  * utils.c - various utility functions used in pppd.
@@ -35,7 +35,7 @@
 #if 0
 #define RCSID	"Id: utils.c,v 1.24 2004/11/04 10:02:26 paulus Exp"
 #else
-__RCSID("$NetBSD: utils.c,v 1.3 2006/11/05 09:16:20 martin Exp $");
+__RCSID("$NetBSD: utils.c,v 1.4 2010/04/02 15:40:14 christos Exp $");
 #endif
 #endif
 
@@ -271,9 +271,12 @@
 #endif
 	case 't':
 	    time(&t);
-	    str = ctime(&t);
-	    str += 4;		/* chop off the day name */
-	    str[15] = 0;	/* chop off year and newline */
+	    if ((str = ctime(&t)) == NULL)
+		    strlcpy(str = num, "?", sizeof(num);
+	    else {
+		    str += 4;		/* chop off the day name */
+		    str[15] = 0;	/* chop off year and newline */
+	    }
 	    break;
 	case 'v':		/* "visible" string */
 	case 'q':		/* quoted string */

Reply via email to