svn commit: r218664 - stable/8/usr.bin/who

Ed Schouten ed at FreeBSD.org
Sun Feb 13 19:37:05 UTC 2011


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)


More information about the svn-src-all mailing list