summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-event/sd-event.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-03 18:49:45 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-03 20:42:09 -0400
commit7057bd993110c1eff0cd3a8776902ca66417634e (patch)
treeacaf2664b7ee5c5668769a66088335f8bc222710 /src/libsystemd/sd-event/sd-event.c
parent610158048a03f25be88a36cb7c81d11177a2c559 (diff)
sd-event: check the value of received signal
Appease coverity report #1237775. Also rename ss to n, to make it visually different from ss.
Diffstat (limited to 'src/libsystemd/sd-event/sd-event.c')
-rw-r--r--src/libsystemd/sd-event/sd-event.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index b56182dda7..4c67ee87e1 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -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) {