Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 May 1997 13:18:48 +0400 (MSD)
From:      tim@pool1.convey.ru
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/3638: /bin/w can't handle long /dev/{tty,cua}xxxxx 
Message-ID:  <199705200918.NAA05375@pool1.convey.ru>
Resent-Message-ID: <199705200920.CAA24957@hub.freebsd.org>

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

>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:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 20 02:20:01 PDT 1997
>Last-Modified:
>Originator:     Andrew Timonin
>Organization:
Internet Services Ltd.
>Release:        FreeBSD 2.2.2-RELEASE i386
>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

>Audit-Trail:
>Unformatted:



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