]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Don't leak temporary fds pointing to /dev/null
authorMichel HERMIER <hermier@frugalware.org>
Fri, 9 Nov 2012 15:44:43 +0000 (15:44 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 9 Nov 2012 16:17:17 +0000 (16:17 +0000)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=56927
[commit message added -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-sysdeps-util-unix.c
tools/dbus-launch.c

index d57e6aadc21b56fa597cb093a604af3f84750776..4f81e6a64cedc87ce066205c0c32be0981595339 100644 (file)
@@ -123,6 +123,7 @@ _dbus_become_daemon (const DBusString *pidfile,
             dup2 (dev_null_fd, 2);
           else
             _dbus_verbose ("keeping stderr open due to DBUS_DEBUG_OUTPUT\n");
+          close (dev_null_fd);
         }
 
       if (!keep_umask)
index bbaac2c3a8907db15db3fb093cb29182879bbc9a..bb639a119f7a45c46c312033683501b5ba7997f6 100644 (file)
@@ -583,6 +583,7 @@ babysit (int   exit_with_session,
       s = getenv ("DBUS_DEBUG_OUTPUT");
       if (s == NULL || *s == '\0')
         dup2 (dev_null_fd, 2);
+      close (dev_null_fd);
     }
   else
     {