Module Name: src
Committed By: mlelstv
Date: Sun Jun 8 09:53:43 UTC 2014
Modified Files:
src/usr.bin/who: who.c
Log Message:
Handle ctime() failure.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/who/who.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/who/who.c
diff -u src/usr.bin/who/who.c:1.23 src/usr.bin/who/who.c:1.24
--- src/usr.bin/who/who.c:1.23 Thu Jul 24 15:35:41 2008
+++ src/usr.bin/who/who.c Sun Jun 8 09:53:43 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: who.c,v 1.23 2008/07/24 15:35:41 christos Exp $ */
+/* $NetBSD: who.c,v 1.24 2014/06/08 09:53:43 mlelstv Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
#if 0
static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: who.c,v 1.23 2008/07/24 15:35:41 christos Exp $");
+__RCSID("$NetBSD: who.c,v 1.24 2014/06/08 09:53:43 mlelstv Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -285,6 +285,7 @@ print(const char *name, const char *line
time_t idle;
const char *types = NULL;
size_t i;
+ char *tstr;
state = '?';
idle = 0;
@@ -312,7 +313,8 @@ print(const char *name, const char *line
(void)printf("%c ", state);
(void)printf("%-*.*s ", maxline, maxline, line);
- (void)printf("%.12s ", ctime(&t) + 4);
+ tstr = ctime(&t);
+ (void)printf("%.12s ", tstr ? tstr + 4 : "?");
if (show_idle) {
if (idle < 60)