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:
Zbigniew Jędrzejewski-Szmek 2014-10-03 18:49:45 -04:00
parent 610158048a
commit 7057bd9931
1 changed files with 6 additions and 4 deletions

View File

@ -1973,20 +1973,22 @@ static int process_signal(sd_event *e, uint32_t events) {
for (;;) {
struct signalfd_siginfo si;
ssize_t ss;
ssize_t n;
sd_event_source *s = NULL;
ss = read(e->signal_fd, &si, sizeof(si));
if (ss < 0) {
n = read(e->signal_fd, &si, sizeof(si));
if (n < 0) {
if (errno == EAGAIN || errno == EINTR)
return read_one;
return -errno;
}
if (_unlikely_(ss != sizeof(si)))
if (_unlikely_(n != sizeof(si)))
return -EIO;
assert(si.ssi_signo < _NSIG);
read_one = true;
if (si.ssi_signo == SIGCHLD) {