summaryrefslogtreecommitdiffstats
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-07 15:39:42 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-07 16:05:04 +0200
commit8f4d6401351b1114117a1517283f00c7f349c9ff (patch)
tree08aae76d645cccfabbc0cba7ec23314defc7349b /src/core/manager.c
parentmanager: tighten incoming notification message checks (diff)
downloadsystemd-8f4d6401351b1114117a1517283f00c7f349c9ff.tar.xz
systemd-8f4d6401351b1114117a1517283f00c7f349c9ff.zip
core: only warn on short reads on signal fd
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 34db276a7d..c1dce62a18 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1946,14 +1946,17 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
for (;;) {
n = read(m->signal_fd, &sfsi, sizeof(sfsi));
if (n != sizeof(sfsi)) {
+ if (n >= 0) {
+ log_warning("Truncated read from signal fd (%zu bytes)!", n);
+ return 0;
+ }
- if (n >= 0)
- return -EIO;
-
- if (errno == EINTR || errno == EAGAIN)
+ if (IN_SET(errno, EINTR, EAGAIN))
break;
- return -errno;
+ /* We return an error here, which will kill this handler,
+ * to avoid a busy loop on read error. */
+ return log_error_errno(errno, "Reading from signal fd failed: %m");
}
log_received_signal(sfsi.ssi_signo == SIGCHLD ||