summaryrefslogtreecommitdiff
path: root/Userland/kill.cpp
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2020-04-25 17:41:14 -0700
committerAndreas Kling <kling@serenityos.org>2020-04-26 12:54:10 +0200
commit597ff9ec93f3c5bc00c993f6c63300f7ebe532e2 (patch)
tree1747276e34783605a0a260685635167052c9b055 /Userland/kill.cpp
parent1f64e3eb168df9e4ff67d78fec95a4f0f777b6ae (diff)
downloadserenity-597ff9ec93f3c5bc00c993f6c63300f7ebe532e2.zip
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.
Diffstat (limited to 'Userland/kill.cpp')
-rw-r--r--Userland/kill.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/kill.cpp b/Userland/kill.cpp
index ea4805a1a0..c868147355 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;