Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jan 2010 10:50:17 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r201487 - head/bin/pkill
Message-ID:  <201001041050.o04AoHJS036178@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: obrien
Date: Mon Jan  4 10:50:17 2010
New Revision: 201487
URL: http://svn.freebsd.org/changeset/base/201487

Log:
  Committed the wrong version in r201484.  This time really fix the "-t"
  functionality.  Per the regression tests (pgrep-t.t & pkill-t.t), "-t"
  should accept "v1", which means a plain number should be accepted for
  UNIX98-style PTY's.

Modified:
  head/bin/pkill/pkill.c

Modified: head/bin/pkill/pkill.c
==============================================================================
--- head/bin/pkill/pkill.c	Mon Jan  4 10:39:16 2010	(r201486)
+++ head/bin/pkill/pkill.c	Mon Jan  4 10:50:17 2010	(r201487)
@@ -670,6 +670,20 @@ makelist(struct listhead *head, enum lis
 				if (li->li_number == 0)
 					li->li_number = -1;	/* any jail */
 				break;
+			case LT_TTY:
+				if (li->li_number < 0)
+					errx(STATUS_BADUSAGE,
+					     "Negative /dev/pts tty `%s'", sp);
+				snprintf(buf, sizeof(buf), _PATH_DEV "pts/%s",
+				    sp);
+				if (stat(buf, &st) != -1)
+					goto foundtty;
+				if (errno == ENOENT)
+					errx(STATUS_BADUSAGE, "No such tty: `"
+					    _PATH_DEV "pts/%s'", sp);
+				err(STATUS_ERROR, "Cannot access `"
+				    _PATH_DEV "pts/%s'", sp);
+				break;
 			default:
 				break;
 			}
@@ -705,10 +719,6 @@ makelist(struct listhead *head, enum lis
 			if (stat(buf, &st) != -1)
 				goto foundtty;
 
-			snprintf(buf, sizeof(buf), _PATH_DEV "pts/%s", cp);
-			if (stat(buf, &st) != -1)
-				goto foundtty;
-
 			if (errno == ENOENT)
 				errx(STATUS_BADUSAGE, "No such tty: `%s'", sp);
 			err(STATUS_ERROR, "Cannot access `%s'", sp);



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