Module Name:    src
Committed By:   martin
Date:           Sun Mar 13 12:02:49 UTC 2016

Modified Files:
        src/usr.bin/finger [netbsd-7]: util.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #1137):
        usr.bin/finger/util.c: revision 1.29
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.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.24.1 src/usr.bin/finger/util.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/finger/util.c
diff -u src/usr.bin/finger/util.c:1.28 src/usr.bin/finger/util.c:1.28.24.1
--- src/usr.bin/finger/util.c:1.28	Sun Apr 12 06:18:54 2009
+++ src/usr.bin/finger/util.c	Sun Mar 13 12:02:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.28 2009/04/12 06:18:54 lukem Exp $	*/
+/*	$NetBSD: util.c,v 1.28.24.1 2016/03/13 12:02:48 martin 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.28.24.1 2016/03/13 12:02:48 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -358,6 +358,8 @@ find_idle_and_ttywrite(WHERE *w)
 	(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;

Reply via email to