Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Dec 2022 02:46:05 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 268093] [PATCH] killall(1) allow sending signals to pts(4)
Message-ID:  <bug-268093-227-yuBfBAdV4L@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-268093-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-268093-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268093

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) =3D=3D 0)
                        snprintf(buf, sizeof(buf), "%s", tty);
-               else if (strncmp(tty, "tty", 3) =3D=3D 0)
+               else if (strncmp(tty, "tty", 3) =3D=3D 0 ||
+                   strncmp(tty, "pts/", 4) =3D=3D 0)
                        snprintf(buf, sizeof(buf), "/dev/%s", tty);
                else
                        snprintf(buf, sizeof(buf), "/dev/tty%s", tty);

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268093-227-yuBfBAdV4L>