Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/finger in find_idle_and_ttywrite(), initialize idlet...
details: https://anonhg.NetBSD.org/src/rev/4efad852d4a1
branches: trunk
changeset: 344009:4efad852d4a1
user: chs <chs%NetBSD.org@localhost>
date: Wed Mar 09 16:12:14 2016 +0000
description:
in find_idle_and_ttywrite(), initialize idletime and writable to 0
when stat() fails. this prevents a coredump later in stimeprint()
due to gmtime() returning NULL for an uninitialized idletime.
diffstat:
usr.bin/finger/util.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r f00749f061e0 -r 4efad852d4a1 usr.bin/finger/util.c
--- a/usr.bin/finger/util.c Wed Mar 09 15:58:25 2016 +0000
+++ b/usr.bin/finger/util.c Wed Mar 09 16:12:14 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.28 2009/04/12 06:18:54 lukem Exp $ */
+/* $NetBSD: util.c,v 1.29 2016/03/09 16:12:14 chs Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -72,7 +72,7 @@
#if 0
static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: util.c,v 1.28 2009/04/12 06:18:54 lukem Exp $");
+__RCSID("$NetBSD: util.c,v 1.29 2016/03/09 16:12:14 chs Exp $");
#endif
#endif /* not lint */
@@ -358,6 +358,8 @@
(void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_DEV, w->tty);
if (stat(tbuf, &sb) < 0) {
warn("%s", tbuf);
+ w->idletime = 0;
+ w->writable = 0;
return;
}
w->idletime = now < sb.st_atime ? 0 : now - sb.st_atime;
Home |
Main Index |
Thread Index |
Old Index