mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
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.
This commit is contained in:
parent
1f64e3eb16
commit
597ff9ec93
Notes:
sideshowbarker
2024-07-19 07:17:29 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/597ff9ec93f Pull-request: https://github.com/SerenityOS/serenity/pull/1961 Reviewed-by: https://github.com/awesomekling
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user