From: Michel HERMIER Date: Fri, 9 Nov 2012 15:44:43 +0000 (+0000) Subject: Don't leak temporary fds pointing to /dev/null X-Git-Tag: dbus-1.6.10~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a9b0e2736378d1a8961fb264d7314e921231e8e;p=platform%2Fupstream%2Fdbus.git Don't leak temporary fds pointing to /dev/null Bug: https://bugs.freedesktop.org/show_bug.cgi?id=56927 [commit message added -smcv] Reviewed-by: Simon McVittie --- diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 76423ab..6cff3fe 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -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) diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 1ec9ae5..2a9dabf 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -633,6 +633,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 {