diff --git a/libdaemon-0.13-bnc469342.diff b/libdaemon-0.13-bnc469342.diff new file mode 100644 index 0000000..6eb5f91 --- /dev/null +++ b/libdaemon-0.13-bnc469342.diff @@ -0,0 +1,33 @@ + +Index: b/libdaemon/dfork.c +=================================================================== +--- a/libdaemon/dfork.c ++++ b/libdaemon/dfork.c +@@ -529,10 +529,13 @@ int daemon_close_allv(const int except_f + closedir(d); + errno = saved_errno; + + return -1; + } ++ ++ if (fd == _daemon_retval_pipe[0]) ++ _daemon_retval_pipe[0] = -1; /* mark as closed */ + } + + closedir(d); + return 0; + } +@@ -561,10 +564,13 @@ int daemon_close_allv(const int except_f + if (found) + continue; + + if (close(fd) < 0 && errno != EBADF) + return -1; ++ ++ if (fd == _daemon_retval_pipe[0]) ++ _daemon_retval_pipe[0] = -1; /* mark as closed */ + } + + return 0; + } + diff --git a/libdaemon.changes b/libdaemon.changes index 4bdfbe8..c1e8c89 100644 --- a/libdaemon.changes +++ b/libdaemon.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jan 27 17:57:08 CET 2009 - seife@suse.de + +- mark filedescritor as closed after closing it, preventing + application errors in e.g. avahi (bnc#469342, bnc#442210) + Thanks to Stefan Thaeter for providing the patch. + ------------------------------------------------------------------- Thu Nov 27 15:55:45 CET 2008 - seife@suse.de diff --git a/libdaemon.spec b/libdaemon.spec index f6c6384..69d3a5a 100644 --- a/libdaemon.spec +++ b/libdaemon.spec @@ -22,12 +22,13 @@ Name: libdaemon BuildRequires: doxygen Url: http://0pointer.de/lennart/projects/libdaemon/ Version: 0.13 -Release: 1 +Release: 2 Summary: Lightweight C library That Eases the Writing of UNIX Daemons License: LGPL v2.1 or later Group: System/Libraries Source: %{name}-%{version}.tar.bz2 Patch2: libdaemon-0.12-bnc449728.diff +Patch3: libdaemon-0.13-bnc469342.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %package -n libdaemon0 @@ -128,6 +129,7 @@ Authors: %prep %setup -q %patch2 -p1 +%patch3 -p1 %build export CFLAGS="$RPM_OPT_FLAGS" @@ -158,6 +160,10 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/libdaemon/*.h %changelog +* Tue Jan 27 2009 seife@suse.de +- mark filedescritor as closed after closing it, preventing + application errors in e.g. avahi (bnc#469342, bnc#442210) + Thanks to Stefan Thaeter for providing the patch. * Thu Nov 27 2008 seife@suse.de - update to version 0.13: - add daemon_reset_sigs() and daemon_unblock_sigs()