From tim@pool1.convey.ru  Tue May 20 02:18:59 1997
Received: from pool1.convey.ru (root@pool1.convey.ru [195.182.128.3])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id CAA24903
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 May 1997 02:18:56 -0700 (PDT)
Received: (from root@localhost) by pool1.convey.ru (8.8.5/8.7.3) id NAA05375; Tue, 20 May 1997 13:18:48 +0400 (MSD)
Message-Id: <199705200918.NAA05375@pool1.convey.ru>
Date: Tue, 20 May 1997 13:18:48 +0400 (MSD)
From: tim@pool1.convey.ru
Reply-To: tim@convey.ru
To: FreeBSD-gnats-submit@freebsd.org
Subject: /bin/w can't handle long /dev/{tty,cua}xxxxx 
X-Send-Pr-Version: 3.2

>Number:         3638
>Category:       bin
>Synopsis:       /bin/w can't handle long /dev/{tty,cua}xxxxx
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 20 02:20:01 PDT 1997
>Closed-Date:    Wed Mar 31 13:03:08 PST 1999
>Last-Modified:  Wed Mar 31 13:03:29 PST 1999
>Originator:     Andrew Timonin
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
Internet Services Ltd.
>Environment:
FreeBSD 2.2.2-RELEASE used as PPP access server 

	We are using a number of modems with names like
	/dev/cuaD0001, /dev/cuaD0002 etc.

>Description:
	
	When i run "w" command, I get: 
	"w: /dev//cuaD0005mayor: No such file or directory"

>How-To-Repeat:

	Simply rename some tty to for ex. /dev/ttyv0005,
	login to it and type "w"


>Fix:

*** w.c.orig	Tue May 20 12:28:08 1997
--- w.c	Tue May 20 12:27:04 1997
***************
*** 208,214 ****
--- 208,217 ----
  		*nextp = ep;
  		nextp = &(ep->next);
  		memmove(&(ep->utmp), &utmp, sizeof(struct utmp));
+ 		ch = ep->utmp.ut_line[sizeof(utmp.ut_line)];
+ 		ep->utmp.ut_line[sizeof(utmp.ut_line)] = '\0';
  		stp = ttystat(ep->utmp.ut_line);
+ 		ep->utmp.ut_line[sizeof(utmp.ut_line)] = ch;
  		ep->tdev = stp->st_rdev;
  #ifdef CPU_CONSDEV
  		/*
***************
*** 235,241 ****
  		if (wcmd == 0)
  			exit (0);
  
! #define HEADER	"USER     TTY FROM              LOGIN@  IDLE WHAT\n"
  #define WUSED	(sizeof (HEADER) - sizeof ("WHAT\n"))
  		(void)printf(HEADER);
  	}
--- 238,244 ----
  		if (wcmd == 0)
  			exit (0);
  
! #define HEADER	"USER     TTY   FROM              LOGIN@  IDLE WHAT\n"
  #define WUSED	(sizeof (HEADER) - sizeof ("WHAT\n"))
  		(void)printf(HEADER);
  	}
***************
*** 338,344 ****
  			    ep->utmp.ut_host + UT_HOSTSIZE - x, x);
  			p = buf;
  		}
! 		(void)printf("%-*.*s %-3.3s %-*.*s ",
  		    UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,
  		    strncmp(ep->utmp.ut_line, "tty", 3) &&
  		    strncmp(ep->utmp.ut_line, "cua", 3) ?
--- 341,347 ----
  			    ep->utmp.ut_host + UT_HOSTSIZE - x, x);
  			p = buf;
  		}
! 		(void)printf("%-*.*s %-5.5s %-*.*s ",
  		    UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,
  		    strncmp(ep->utmp.ut_line, "tty", 3) &&
  		    strncmp(ep->utmp.ut_line, "cua", 3) ?
	
__
tim@convey.ru

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Wed Mar 31 13:03:08 PST 1999 
State-Changed-Why:  
Fixed in -current. 
>Unformatted:
