From owner-freebsd-bugs Tue May 20 02:20:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA24971 for bugs-outgoing; Tue, 20 May 1997 02:20:04 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA24957; Tue, 20 May 1997 02:20:02 -0700 (PDT) Resent-Date: Tue, 20 May 1997 02:20:02 -0700 (PDT) Resent-Message-Id: <199705200920.CAA24957@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, tim@convey.ru 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 ; 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 X-Send-Pr-Version: 3.2 Subject: bin/3638: /bin/w can't handle long /dev/{tty,cua}xxxxx Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >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: