diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2008-09-30 17:30:39 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2008-09-30 17:30:39 +0000 |
| commit | 18aa158f771bf46f35cae339850e8fffda764d46 (patch) | |
| tree | 668455da92df506249c2bb5349453c05edd4fbcb /bin | |
| parent | 3e460b606a81f1d5bbb501dac83a089118866398 (diff) | |
Notes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/pkill/pkill.1 | 7 | ||||
| -rw-r--r-- | bin/pkill/pkill.c | 18 |
2 files changed, 14 insertions, 11 deletions
diff --git a/bin/pkill/pkill.1 b/bin/pkill/pkill.1 index 22b67bfd354c..725f27eff849 100644 --- a/bin/pkill/pkill.1 +++ b/bin/pkill/pkill.1 @@ -179,9 +179,10 @@ command. Restrict matches to processes associated with a terminal in the comma-separated list .Ar tty . -The -.Pa /dev/ -prefix of the terminal names must be omitted. +Terminal names may be of the form +.Pa tty Ns Ar xx +or the shortened form +.Ar xx . A single dash .Pq Ql - matches processes not associated with a terminal. diff --git a/bin/pkill/pkill.c b/bin/pkill/pkill.c index 649e7b7aae21..da8fbcdf749d 100644 --- a/bin/pkill/pkill.c +++ b/bin/pkill/pkill.c @@ -675,16 +675,18 @@ makelist(struct listhead *head, enum listtype type, char *src) } snprintf(buf, sizeof(buf), _PATH_DEV "%s", cp); + if (stat(buf, &st) != -1) + goto foundtty; - if (stat(buf, &st) == -1) { - if (errno == ENOENT) { - errx(STATUS_BADUSAGE, - "No such tty: `%s'", sp); - } - err(STATUS_ERROR, "Cannot access `%s'", sp); - } + snprintf(buf, sizeof(buf), _PATH_DEV "tty%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); - if ((st.st_mode & S_IFCHR) == 0) +foundtty: if ((st.st_mode & S_IFCHR) == 0) errx(STATUS_BADUSAGE, "Not a tty: `%s'", sp); li->li_number = st.st_rdev; |
