Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 1997 11:14:52 PST
From:      Bill Fenner <fenner@parc.xerox.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2832: w treats corrupted utmp as fatal error
Message-ID:  <199702281914.LAA10869@fenestro.parc.xerox.com>
Resent-Message-ID: <199702281920.LAA12839@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2832
>Category:       bin
>Synopsis:       w treats corrupted utmp as fatal error
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 28 11:20:01 PST 1997
>Last-Modified:
>Originator:     Bill Fenner
>Organization:
Xerox
>Release:        FreeBSD 2.2-BETA_A i386
>Environment:

	
FreeBSD fenestro.parc.xerox.com 2.2-BETA_A FreeBSD 2.2-BETA_A #1: Sat Jan 18 18:30:51 PST 1997     fenner@fenestro.parc.xerox.com:/usr/src/sys/compile/FENESTRO  i386

2.2-BETA installed via ftp from ftp.freebsd.org in mid-January.
X11R6 installed in that installation.

>Description:

	
My utmp file got corrupted (I don't know how).

% who | cat -v
root     ttyv0   Feb 22 20:08
fenner   ttyv1   Feb 22 21:30
fenner   ttyp5   Feb 27 17:26	(crevenia)
4        {q^P3ttypDec 31 16:00	(er)

w fails to run:

% w
w: /dev//{q^P3ttyp4: No such file or directory

while it could at least manage to print out as much as who does.

>How-To-Repeat:

	
Corrupt your utmp file so that a tty field references a nonexistent
device, and then run "w".


>Fix:
	
	

--- w.c.orig	Fri Feb 28 11:10:06 1997
+++ w.c	Fri Feb 28 11:11:28 1997
@@ -438,7 +438,7 @@
 
 	(void)snprintf(ttybuf, sizeof(ttybuf), "%s/%s", _PATH_DEV, line);
 	if (stat(ttybuf, &sb))
-		err(1, "%s", ttybuf);
+		warn("%s", ttybuf);
 	return (&sb);
 }
 
% ./w |& cat -v
w: /dev//{q^P3ttyp4: No such file or directory
11:12AM  up 5 days, 15:06, 5 users, load averages: 0.04, 0.03, 0.00
USER     TTY FROM              LOGIN@  IDLE WHAT
root     v0  -                Sat08PM 13:54 -csh (csh)
fenner   v1  -                Sat09PM 5days xinit
ttyp0        fenner           13Aug95  9:12 -
fenner   p5  crevenia          5:26PM     - ./w
4        {q^P er               31Dec69     - -

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702281914.LAA10869>