ba9b55aa79
1 OBS-URL: https://build.opensuse.org/request/show/262952 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=209
47 lines
1.5 KiB
Diff
47 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 src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c
|
|
index b56182d..4c67ee8 100644
|
|
--- src/libsystemd/sd-event/sd-event.c
|
|
+++ 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) {
|
|
--
|
|
1.7.9.2
|
|
|