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