don't leak inotify fd

This commit is contained in:
Matthias Clasen 2009-06-27 22:57:02 +00:00
parent 0a34610b36
commit 1b782490ac
2 changed files with 36 additions and 3 deletions

View File

@ -0,0 +1,27 @@
diff -u -r dbus-1.2.14/bus/dir-watch-inotify.c dbus-1.2.14.fd-leak/bus/dir-watch-inotify.c
--- dbus-1.2.14/bus/dir-watch-inotify.c 2009-04-17 15:45:29.000000000 -0400
+++ dbus-1.2.14.fd-leak/bus/dir-watch-inotify.c 2009-06-27 18:38:54.966881736 -0400
@@ -98,7 +98,11 @@
_dbus_assert (dir != NULL);
if (inotify_fd == -1) {
+#ifdef HAVE_INOTIFY_INIT1
+ inotify_fd = inotify_init1 (IN_CLOEXEC);
+#else
inotify_fd = inotify_init ();
+#endif
if (inotify_fd <= 0) {
_dbus_warn ("Cannot initialize inotify\n");
goto out;
diff -u -r dbus-1.2.14/configure.in dbus-1.2.14.fd-leak/configure.in
--- dbus-1.2.14/configure.in 2009-05-06 12:51:19.000000000 -0400
+++ dbus-1.2.14.fd-leak/configure.in 2009-06-27 18:37:10.787645299 -0400
@@ -983,7 +983,7 @@
dnl check if inotify backend is enabled
if test x$have_inotify = xyes; then
AC_DEFINE(DBUS_BUS_ENABLE_INOTIFY,1,[Use inotify])
-
+ AC_CHECK_FUNCS(inotify_init1)
fi
AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes)

View File

@ -9,7 +9,7 @@ Summary: D-BUS message bus
Name: dbus
Epoch: 1
Version: 1.2.14
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://www.freedesktop.org/software/dbus/
Source0: http://dbus.freedesktop.org/releases/dbus/%{name}-%{version}.tar.gz
Source1: doxygen_to_devhelp.xsl
@ -41,6 +41,8 @@ Conflicts: cups < 1:1.1.20-4
Patch0: start-early.patch
Patch1: dbus-1.0.1-generate-xml-docs.patch
Patch6: dbus-1.2.1-increase-timeout.patch
# https://bugs.freedesktop.org/show_bug.cgi?id=22516
Patch7: dbus-inotify-fd-leak.patch
%description
D-BUS is a system for sending messages between applications. It is
@ -63,7 +65,7 @@ Requires: %name = %{epoch}:%{version}-%{release}
Requires: devhelp
BuildArch: noarch
%description doc
%description doc
This package contains developer documentation for D-Bus along with
other supporting documentation such as the introspect dtd file.
@ -96,6 +98,7 @@ in this separate package so server systems need not install X.
%patch0 -p1 -b .start-early
%patch1 -p1 -b .generate-xml-docs
%patch6 -p1 -b .increase-timeout
%patch7 -p1 -b .inotify-fd-leak
autoreconf -f -i
@ -157,7 +160,7 @@ rm -rf %{buildroot}
%post libs -p /sbin/ldconfig
%post
/sbin/chkconfig --add messagebus
/sbin/chkconfig --add messagebus
/sbin/chkconfig messagebus resetpriorities
%preun
@ -227,6 +230,9 @@ fi
%{_includedir}/*
%changelog
* Sat Jun 27 2009 Matthias Clasen <mclasen@redhat.com> - 1:1.2.14-2
- Don't leak inotify fd (#505338)
* Wed Apr 22 2009 Colin Walters <walters@verbum.org> - 1:1.2.14-1
- CVE-2009-1189
* Update to 1.2.14