mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
Kernel+LibC: A lot of the signal handling code was off-by-one.
There is no signal 0. The valid ones are 1 (SIGHUP) through 31 (SIGSYS) Found by PVS-Studio.
This commit is contained in:
parent
bd08664f05
commit
be4d33fb2c
2 changed files with 10 additions and 10 deletions
|
@ -63,7 +63,7 @@ int sigaddset(sigset_t* set, int sig)
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*set |= 1 << (sig);
|
||||
*set |= 1 << (sig - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ int sigdelset(sigset_t* set, int sig)
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*set &= ~(1 << (sig));
|
||||
*set &= ~(1 << (sig - 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ int sigismember(const sigset_t* set, int sig)
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (*set & (1 << (sig)))
|
||||
if (*set & (1 << (sig - 1)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue