mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 22:02:12 +00:00
Kernel: Don't assert on sys$kill() with pid=INT32_MIN
On 32-bit platforms, INT32_MIN == -INT32_MIN, so we can't expect this to always work: if (pid < 0) positive_pid = -pid; // may still be negative! This happens because the -INT32_MIN expression becomes a long and is then truncated back to an int. Fixes #1312.
This commit is contained in:
parent
22259bf85d
commit
d28fa89346
1 changed files with 4 additions and 1 deletions
|
@ -2213,8 +2213,11 @@ int Process::sys$kill(pid_t pid, int signal)
|
|||
|
||||
if (signal < 0 || signal >= 32)
|
||||
return -EINVAL;
|
||||
if (pid <= 0)
|
||||
if (pid <= 0) {
|
||||
if (pid == INT32_MIN)
|
||||
return -EINVAL;
|
||||
return do_killpg(-pid, signal);
|
||||
}
|
||||
if (pid == -1) {
|
||||
// FIXME: Send to all processes.
|
||||
return -ENOTIMPL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue