[Bug 268093] [PATCH] killall(1) allow sending signals to pts(4)
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 268093] killall(1) allow sending signals to pts(4)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 01 Dec 2022 02:46:05 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268093
Konstantin Belousov <kib@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kib@FreeBSD.org
--- Comment #1 from Konstantin Belousov <kib@FreeBSD.org> ---
It is better to match on pts/, not just pts. For tty, the short match allows
to specify e.g. ttyuX, i.e. USB-serial ports.
Also, there is no need to have two identical snprintfs.
Below is what I intent to commit after your confirmation.
commit e442917ee41986c416afea1d152ad03c5daeeac4
Author: Daniel Dowse <freebsd-bugs@daemonbytes.net>
Date: Thu Dec 1 04:42:35 2022 +0200
killall(1): allow sending signals to processes with control terminal on
pts(4)
PR: 268093
Reviewed by: kib
MFC after: 1 week
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c
index aca0830c158b..494a527d190b 100644
--- a/usr.bin/killall/killall.c
+++ b/usr.bin/killall/killall.c
@@ -255,7 +255,8 @@ main(int ac, char **av)
if (tty) {
if (strncmp(tty, "/dev/", 5) == 0)
snprintf(buf, sizeof(buf), "%s", tty);
- else if (strncmp(tty, "tty", 3) == 0)
+ else if (strncmp(tty, "tty", 3) == 0 ||
+ strncmp(tty, "pts/", 4) == 0)
snprintf(buf, sizeof(buf), "/dev/%s", tty);
else
snprintf(buf, sizeof(buf), "/dev/tty%s", tty);
--
You are receiving this mail because:
You are the assignee for the bug.