- Fix double-free bug when closing daemon file descriptor (avahi.org #148)
This commit is contained in:
parent
c377136fad
commit
f3c1d3d33f
56
libdaemon-0.11-stdarg-fix.patch
Normal file
56
libdaemon-0.11-stdarg-fix.patch
Normal file
@ -0,0 +1,56 @@
|
||||
--- libdaemon-0.11/libdaemon/dfork.c.debug 2007-06-11 11:36:11.000000000 -0400
|
||||
+++ libdaemon-0.11/libdaemon/dfork.c 2007-07-02 14:49:35.000000000 -0400
|
||||
@@ -354,31 +354,38 @@
|
||||
|
||||
int daemon_close_all(int except_fd, ...) {
|
||||
va_list original_ap, ap;
|
||||
- int n, i, r;
|
||||
- int *p;
|
||||
+ int n = 0, i = 0, r = -1;
|
||||
+ int *p = NULL;
|
||||
|
||||
- va_start(original_ap, except_fd);
|
||||
- va_copy(ap, original_ap);
|
||||
+ if (except_fd >= 0) {
|
||||
+ va_start(original_ap, except_fd);
|
||||
+ va_copy(ap, original_ap);
|
||||
|
||||
- for (n = 0; va_arg(ap, int) >= 0; n++)
|
||||
- ;
|
||||
+ for (n = 0; va_arg(ap, int) >= 0; n++)
|
||||
+ ;
|
||||
|
||||
- va_end(ap);
|
||||
-
|
||||
- if (!(p = malloc(sizeof(int) * (n+1)))) {
|
||||
- va_end(original_ap);
|
||||
- return -1;
|
||||
+ va_end(ap);
|
||||
}
|
||||
|
||||
- i = 0;
|
||||
- while ((p[i++] = va_arg(original_ap, int)) >= 0)
|
||||
- ;
|
||||
+ if (!(p = malloc(sizeof(int) * (n+2))))
|
||||
+ goto out;
|
||||
+
|
||||
+ p[i++] = except_fd;
|
||||
+
|
||||
+ if (except_fd >= 0) {
|
||||
+ i = 1;
|
||||
+ while ((p[i++] = va_arg(original_ap, int)) >= 0)
|
||||
+ ;
|
||||
+ }
|
||||
|
||||
p[i] = -1;
|
||||
|
||||
r = daemon_close_allv(p);
|
||||
+
|
||||
+out:
|
||||
+ if (except_fd >= 0)
|
||||
+ va_end(original_ap);
|
||||
free(p);
|
||||
-
|
||||
return r;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: libdaemon
|
||||
Version: 0.11
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: library for writing UNIX daemons
|
||||
|
||||
Group: System Environment/Libraries
|
||||
@ -8,6 +8,7 @@ License: GPL
|
||||
URL: http://www.stud.uni-hamburg.de/users/lennart/projects/libdaemon
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Patch0: libdaemon-0.11-stdarg-fix.patch
|
||||
|
||||
# Requires lynx to build the docs
|
||||
BuildRequires: lynx
|
||||
@ -36,6 +37,7 @@ necessary for developing programs using libdaemon.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1 -b .stdarg-fix
|
||||
|
||||
%build
|
||||
%configure --disable-static
|
||||
@ -68,8 +70,11 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
|
||||
%changelog
|
||||
* Mon Jul 2 2007 Dan Williams <dcbw@redhat.com> - 0.11-2
|
||||
- Fix double-free bug when closing daemon file descriptor (avahi.org #148)
|
||||
|
||||
* Fri Jun 22 2007 Martin Bacovsky <mbacovsk@redhat.com> - 0.11-1
|
||||
- update no new upstream version 0.11
|
||||
- Upgrade to new upstream version 0.11
|
||||
|
||||
* Thu Apr 5 2007 Martin Bacovsky <mbacovsk@redhat.com> - 0.10-4
|
||||
- Resolves: #222855: fileconflict for /usr/share/doc/libdaemon-devel-0.10/Makefile
|
||||
|
Loading…
Reference in New Issue
Block a user