From 597ff9ec93f3c5bc00c993f6c63300f7ebe532e2 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sat, 25 Apr 2020 17:41:14 -0700 Subject: [PATCH] Userland: Fix kill to support negative pid values. The kill system call accepts negative pids, as they have special meaning: pid == -1 means all processes the calling process has access to. pid < -1 means every process who's process group ID is -pid. I don't see any reason why the user space program should mask this. --- Userland/kill.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/kill.cpp b/Userland/kill.cpp index ea4805a1a0d..c868147355b 100644 --- a/Userland/kill.cpp +++ b/Userland/kill.cpp @@ -58,13 +58,13 @@ int main(int argc, char** argv) return 2; } } - unsigned pid = String(argv[pid_argi]).to_uint(ok); + pid_t pid = String(argv[pid_argi]).to_int(ok); if (!ok) { printf("'%s' is not a valid PID\n", argv[pid_argi]); return 3; } - int rc = kill((pid_t)pid, signum); + int rc = kill(pid, signum); if (rc < 0) perror("kill"); return 0;