ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
923a60
From cd238111a7980917e04cfdc5dae144d1fb4c0a49 Mon Sep 17 00:00:00 2001
923a60
From: Jorge Niedbalski <jorge.niedbalski@canonical.com>
923a60
Date: Wed, 28 Sep 2016 18:25:50 -0300
923a60
Subject: [PATCH] If the notification message length is 0, ignore the message
923a60
 (#4237)
923a60
923a60
Fixes #4234.
923a60
923a60
Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
923a60
923a60
Cherry-picked from: 531ac2b2349da02acc9c382849758e07eb92b020
923a60
Resolves: #1380175
923a60
---
923a60
 src/core/manager.c | 4 ++++
923a60
 1 file changed, 4 insertions(+)
923a60
923a60
diff --git a/src/core/manager.c b/src/core/manager.c
923a60
index 71dd70c94c..689b266158 100644
923a60
--- a/src/core/manager.c
923a60
+++ b/src/core/manager.c
923a60
@@ -1678,6 +1678,10 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
923a60
 
923a60
                 return -errno;
923a60
         }
923a60
+        if (n == 0) {
923a60
+                log_debug("Got zero-length notification message. Ignoring.");
923a60
+                return 0;
923a60
+        }
923a60
 
923a60
         CMSG_FOREACH(cmsg, &msghdr) {
923a60
                 if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {