44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
From 7057bd993110c1eff0cd3a8776902ca66417634e Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Fri, 3 Oct 2014 18:49:45 -0400
|
|
Subject: [PATCH] sd-event: check the value of received signal
|
|
|
|
Appease coverity report #1237775.
|
|
|
|
Also rename ss to n, to make it visually different from ss.
|
|
---
|
|
src/libsystemd/sd-event/sd-event.c | 10 ++++++----
|
|
1 file 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) {
|