Fixed leak of a file descriptor Resolves: #304761

This commit is contained in:
Zdenek Prikryl 2007-09-26 13:49:40 +00:00
parent a3d7f9299c
commit 20bfb3174a
3 changed files with 44 additions and 6 deletions

32
acpid-1.0.6-fd.patch Normal file
View File

@ -0,0 +1,32 @@
--- acpid-1.0.6.orig/acpid.c 2007-09-24 18:49:02.000000000 -0400
+++ acpid-1.0.6/acpid.c 2007-09-24 18:52:44.000000000 -0400
@@ -397,7 +397,7 @@ open_log(void)
int log_opts;
/* open /dev/null */
- nullfd = open("/dev/null", O_RDONLY, 0640);
+ nullfd = open("/dev/null", O_RDONLY);
if (nullfd < 0) {
fprintf(stderr, "%s: can't open %s: %s\n", progname,
"/dev/null", strerror(errno));
diff -urp acpid-1.0.6.orig/event.c acpid-1.0.6/event.c
--- acpid-1.0.6.orig/event.c 2007-09-24 18:49:02.000000000 -0400
+++ acpid-1.0.6/event.c 2007-09-24 18:55:10.000000000 -0400
@@ -318,6 +318,7 @@ parse_file(const char *file)
file);
}
free_rule(r);
+ fclose(fp);
return NULL;
}
fclose(fp);
@@ -667,7 +668,7 @@ parse_cmd(const char *cmd, const char *e
i = 0;
memset(buf, 0, sizeof(buf));
- while (i < (sizeof(buf)-1)) {
+ while ((size_t)i < (sizeof(buf)-1)) {
if (*p == '%') {
p++;
if (*p == 'e') {

View File

@ -10,10 +10,10 @@
### BEGIN INIT INFO
# Provides: acpid
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop acpid
# Description: Listen and dispatch ACPI events from the kernel
### END INIT INFO
@ -35,7 +35,7 @@ start() {
fi
# Check for kernel support
if [ ! -f /proc/acpi/event ]; then
echo "$0: need ACPI support in kernel."
echo "$0: need ACPI_PROC_EVENT support in kernel." //zmena podle 260181
exit 1
fi
# Check if it is already running

View File

@ -1,7 +1,7 @@
Summary: ACPI Event Daemon
Name: acpid
Version: 1.0.6
Release: 1%{?dist}
Release: 2%{?dist}
License: GPL
Group: System Environment/Daemons
Source: http://prdownloads.sourceforge.net/acpid/acpid-%{version}.tar.gz
@ -11,6 +11,7 @@ Source3: acpid.video.conf
Source4: acpid.power.conf
Patch1: acpid-1.0.6-makefile.patch
Patch2: acpid-1.0.6-return.patch
Patch3: acpid-1.0.6-fd.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
ExclusiveArch: ia64 x86_64 %{ix86}
URL: http://acpid.sourceforge.net/
@ -27,6 +28,7 @@ acpid is a daemon that dispatches ACPI events to user-space programs.
%setup -q
%patch1 -p1 -b .makefile
%patch2 -p1 -b .return
%patch3 -p1 -b .fd
%build
make %{?_smp_mflags}
@ -85,6 +87,10 @@ if [ "$1" -ge "1" ]; then
fi
%changelog
* Wed Sep 26 2007 Zdenek Prikryl <zprikryl@redhat.com> - 1.0.6-2.fc8
- Fixed leak of a file descriptor
- Resolves: #304761
* Tue Aug 07 2007 Zdenek Prikryl <zprikryl@redhat.com> - 1.0.6-1.fc8
- Updated to version 1.0.6