Hello community, here is the log from the commit of package apcupsd for openSUSE:Factory checked in at Mon Aug 2 11:59:39 CEST 2010. -------- --- apcupsd/apcupsd.changes 2010-03-31 17:52:33.000000000 +0200 +++ apcupsd/apcupsd.changes 2010-07-27 22:12:37.000000000 +0200 @@ -1,0 +2,5 @@ +Tue Jul 27 20:11:58 UTC 2010 - cristian.rodriguez@opensuse.org + +- avoid leaking file descriptors (use CLOEXEC, patch from Fedora) + +------------------------------------------------------------------- calling whatdependson for head-i586 New: ---- apcupsd-3.14.1-cloexec.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ apcupsd.spec ++++++ --- /var/tmp/diff_new_pack.jJdSRo/_old 2010-08-02 11:58:18.000000000 +0200 +++ /var/tmp/diff_new_pack.jJdSRo/_new 2010-08-02 11:58:18.000000000 +0200 @@ -25,7 +25,7 @@ License: GPLv2+ Summary: APC UPS Daemon (Powerful Daemon for APC UPSs) Version: 3.14.6 -Release: 4 +Release: 11 Url: http://www.apcupsd.com/ Source: apcupsd-%{version}.tar.bz2 Source1: apcupsd.init @@ -37,6 +37,7 @@ Patch5: apcupsd-largebuf-overflow.patch Patch8: apcupsd-3.14.5-const.patch Patch9: apcupsd-3.14.6-undef-MIB-for-new-net-snmp.diff +Patch10: apcupsd-3.14.1-cloexec.patch PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep Requires: /usr/bin/mail BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -80,6 +81,7 @@ %patch5 %patch8 %patch9 +%patch10 -p1 %build %{suse_update_config autoconf} ++++++ apcupsd-3.14.1-cloexec.patch ++++++ --- apcupsd-3.14.1/src/apcnis.c.cloexec 2006-08-13 11:00:15.000000000 -0600 +++ apcupsd-3.14.1/src/apcnis.c 2007-08-01 16:26:35.000000000 -0600 @@ -155,6 +155,9 @@ sleep(5 * 60); } + /* Close the socket on exec - avoid leaked file descriptors */ + fcntl(sockfd, F_SETFD, FD_CLOEXEC); + /* Reuse old sockets */ #ifndef HAVE_MINGW if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*)&turnon, sizeof(turnon)) < 0) { --- apcupsd-3.14.1/src/apcupsd.c.cloexec 2006-09-23 11:42:47.000000000 -0600 +++ apcupsd-3.14.1/src/apcupsd.c 2007-08-01 16:27:14.000000000 -0600 @@ -280,6 +280,9 @@ if (ups->event_fd < 0) { log_event(ups, LOG_WARNING, "Could not open events file %s: %s\n", ups->eventfile, strerror(errno)); + } else { + /* Close the file on exec - avoid leaked file descriptors */ + fcntl(ups->event_fd, F_SETFD, FD_CLOEXEC); } } --- apcupsd-3.14.1/src/drivers/usb/linux/linux-usb.c.cloexec 2007-08-01 16:30:28.000000000 -0600 +++ apcupsd-3.14.1/src/drivers/usb/linux/linux-usb.c 2007-08-01 16:42:55.000000000 -0600 @@ -182,8 +182,11 @@ /* Retry 10 times */ for (i = 0; i < 10; i++) { my_data->fd = open_device(ups->device, ups); - if (my_data->fd != -1) + if (my_data->fd != -1) { + /* Close the device on exec - avoid leaked file descriptors */ + fcntl(my_data->fd, F_SETFD, FD_CLOEXEC); return 1; + } sleep(1); } @@ -206,6 +209,8 @@ asnprintf(devname, sizeof(devname), "%s%d", hiddev[j], k); my_data->fd = open_device(devname, ups); if (my_data->fd != -1) { + /* Close the device on exec - avoid leaked file descriptors */ + fcntl(my_data->fd, F_SETFD, FD_CLOEXEC); /* Successful open, save device name and return */ astrncpy(ups->device, devname, sizeof(ups->device)); return 1; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org