mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00: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
|
@ -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 a new issue