mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
sd-event: check the value of received signal
Appease coverity report #1237775. Also rename ss to n, to make it visually different from ss.
This commit is contained in:
parent
610158048a
commit
7057bd9931
@ -1973,20 +1973,22 @@ static int process_signal(sd_event *e, uint32_t events) {
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct signalfd_siginfo si;
|
struct signalfd_siginfo si;
|
||||||
ssize_t ss;
|
ssize_t n;
|
||||||
sd_event_source *s = NULL;
|
sd_event_source *s = NULL;
|
||||||
|
|
||||||
ss = read(e->signal_fd, &si, sizeof(si));
|
n = read(e->signal_fd, &si, sizeof(si));
|
||||||
if (ss < 0) {
|
if (n < 0) {
|
||||||
if (errno == EAGAIN || errno == EINTR)
|
if (errno == EAGAIN || errno == EINTR)
|
||||||
return read_one;
|
return read_one;
|
||||||
|
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_unlikely_(ss != sizeof(si)))
|
if (_unlikely_(n != sizeof(si)))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
assert(si.ssi_signo < _NSIG);
|
||||||
|
|
||||||
read_one = true;
|
read_one = true;
|
||||||
|
|
||||||
if (si.ssi_signo == SIGCHLD) {
|
if (si.ssi_signo == SIGCHLD) {
|
||||||
|
Loading…
Reference in New Issue
Block a user