This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=cfc4908be31c24010cf52193f8ebdefc6d9ab8ea

commit cfc4908be31c24010cf52193f8ebdefc6d9ab8ea
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Jan 20 00:28:44 2020 +0100

    s-s-d: Close the notification socket in the child
    
    This is not really required, as the socket is set as close-on-exec, but
    it confuses some static analyzers. So let's close it explicitly, which
    makes the intention more clear too.
    
    Warned-by: coverity
---
 debian/changelog          | 1 +
 utils/start-stop-daemon.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 4f8ec4960..1ca4db46b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -121,6 +121,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
     - dpkg-split: Fix short lived file descriptor leak in --auto.
     - start-stop-daemon: Explicitly ignore uninmportant function return values.
     - start-stop-daemon: Fix memory leak on multiple --chuid arguments.
+    - start-stop-daemon: Close the notification socket in the child.
   * Build system:
     - Bump minimal Perl version to 5.24.1.
     - Add a serial versioning to the m4 files.
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 7fcfbd28d..3947cc065 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -807,6 +807,10 @@ daemonize(void)
                _exit(0);
        }
 
+       /* Close the notification socket, even though it is close-on-exec. */
+       if (notify_await)
+               close(notify_fd);
+
        /* Create a new session. */
        if (setsid() < 0)
                fatale("cannot set session ID");

-- 
Dpkg.Org's dpkg

Reply via email to