Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2011 19:37:05 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218664 - stable/8/usr.bin/who
Message-ID:  <201102131937.p1DJb5Kt049742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <eivinde terraplane org>
  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)



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