diff options
author | obrien <obrien@FreeBSD.org> | 2010-01-04 10:50:17 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2010-01-04 10:50:17 +0000 |
commit | 6eb349e6b973ea030b2b5c423ba5453fe7b53195 (patch) | |
tree | 824d8fa39c98e390287b87c2b10c9c4cc1a5ed79 /bin | |
parent | 986de484ed08d8eeecdb48dbda72aedaecb06b34 (diff) | |
download | FreeBSD-src-6eb349e6b973ea030b2b5c423ba5453fe7b53195.zip FreeBSD-src-6eb349e6b973ea030b2b5c423ba5453fe7b53195.tar.gz |
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.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pkill/pkill.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bin/pkill/pkill.c b/bin/pkill/pkill.c index 258b3c8..9105c8c 100644 --- a/bin/pkill/pkill.c +++ b/bin/pkill/pkill.c @@ -670,6 +670,20 @@ makelist(struct listhead *head, enum listtype type, char *src) 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 listtype type, char *src) 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); |