From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 13 19:37:05 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75E24106564A; Sun, 13 Feb 2011 19:37:05 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 642DA8FC08; Sun, 13 Feb 2011 19:37:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1DJb59t049744; Sun, 13 Feb 2011 19:37:05 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1DJb5Kt049742; Sun, 13 Feb 2011 19:37:05 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201102131937.p1DJb5Kt049742@svn.freebsd.org> From: Ed Schouten Date: Sun, 13 Feb 2011 19:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218664 - stable/8/usr.bin/who X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2011 19:37:05 -0000 Author: ed Date: Sun Feb 13 19:37:05 2011 New Revision: 218664 URL: http://svn.freebsd.org/changeset/base/218664 Log: Partially merge a change made in r200166. It seems the utmpx fixes for who(1) also contained a small change to make it work properly with the pts/%u naming. Unfortunately, this change was never merged to FreeBSD 8. Properly remove the /dev/ part of the TTY name instead of stripping until the last /. Reported by: Eivind E Tested by: uqs@ Modified: stable/8/usr.bin/who/who.c Modified: stable/8/usr.bin/who/who.c ============================================================================== --- stable/8/usr.bin/who/who.c Sun Feb 13 19:34:48 2011 (r218663) +++ stable/8/usr.bin/who/who.c Sun Feb 13 19:37:05 2011 (r218664) @@ -266,8 +266,8 @@ whoami(FILE *fp) if ((tty = ttyname(STDIN_FILENO)) == NULL) tty = "tty??"; - else if ((p = strrchr(tty, '/')) != NULL) - tty = p + 1; + else if (strncmp(tty, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) + tty += sizeof _PATH_DEV - 1; /* Search utmp for our tty, dump first matching record. */ while (fread(&ut, sizeof(ut), 1, fp) == 1)