Source-Changes-HG archive

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

[src/trunk]: src/dist/pppd/pppd handle ctime returning NULL.



details:   https://anonhg.NetBSD.org/src/rev/6d823ae7f12b
branches:  trunk
changeset: 753579:6d823ae7f12b
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 02 15:40:14 2010 +0000

description:
handle ctime returning NULL.

diffstat:

 dist/pppd/pppd/utils.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 43fd3761844b -r 6d823ae7f12b dist/pppd/pppd/utils.c
--- a/dist/pppd/pppd/utils.c    Fri Apr 02 15:38:05 2010 +0000
+++ b/dist/pppd/pppd/utils.c    Fri Apr 02 15:40:14 2010 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index