NetBSD Problem Report #272

From gnats  Tue May 31 19:43:18 1994
Received: from relay.hp.com (relay.hp.com [15.255.152.2]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with SMTP id TAA07092 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Tue, 31 May 1994 19:43:17 -0700
Message-Id: <199406010230.WAA01902@sussex.hudson.ma>
Date: Tue, 31 May 1994 22:30:23 -0400
From: John Brezak <brezak@ch.hp.com>
Reply-To: brezak@ch.hp.com
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: w(1) can get confused with non-ttys in utmp
X-Send-Pr-Version: 3.2

>Number:         272
>Category:       bin
>Synopsis:       w(1) can get confused with non-tty's in utmp.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 31 19:50:03 +0000 1994
>Closed-Date:    Sun Jul 17 04:34:38 +0000 1994
>Last-Modified:  
>Originator:     John Brezak
>Release:        5/30/94
>Organization:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 John Brezak                    UUCP:     uunet!apollo.hp!brezak
 Hewlett Packard/Apollo         Internet: brezak@ch.hp.com
 300 Apollo Drive               Phone:    (508) 436-4915
 Chelmsford, Massachusetts      Fax:      (508) 436-5103
>Environment:

System: NetBSD sussex 0.9B NetBSD 0.9B (SUSSEX) #3: Tue May 31 05:52:59 EDT 1994 brezak@sussex:/u0/src/netbsd/sys/arch/i386/compile/SUSSEX i386


>Description:
	If there is a non-tty entry in utmp, w(1) will exit with an error.
However there are legitimate non-tty entries, for instance an xlogin via
xdm can be identified with the xlogin program. In this case there is an
entry with the display name as the ut_tty.
>How-To-Repeat:
>Fix:
	A slight change to the logic to return a status and ignore the tty.
Instead of exitting with an err().

*** w.c~	Mon May  9 06:52:30 1994
--- w.c	Tue May 31 22:20:50 1994
***************
*** 191,197 ****
  		*nextp = ep;
  		nextp = &(ep->next);
  		memmove(&(ep->utmp), &utmp, sizeof(struct utmp));
! 		stp = ttystat(ep->utmp.ut_line);
  		ep->tdev = stp->st_rdev;
  #ifdef CPU_CONSDEV
  		/*
--- 191,198 ----
  		*nextp = ep;
  		nextp = &(ep->next);
  		memmove(&(ep->utmp), &utmp, sizeof(struct utmp));
! 		if (!(stp = ttystat(ep->utmp.ut_line)))
! 			continue;
  		ep->tdev = stp->st_rdev;
  #ifdef CPU_CONSDEV
  		/*
***************
*** 409,415 ****

  	(void)snprintf(ttybuf, sizeof(ttybuf), "%s/%s", _PATH_DEV, line);
  	if (stat(ttybuf, &sb))
! 		err(1, "%s", ttybuf);
  	return (&sb);
  }

--- 410,416 ----

  	(void)snprintf(ttybuf, sizeof(ttybuf), "%s/%s", _PATH_DEV, line);
  	if (stat(ttybuf, &sb))
! 		return (NULL);
  	return (&sb);
  }


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Sat Jul 16 21:34:38 PDT 1994 
State-Changed-Why:  
fixed (patch applied) a few weeks ago. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.