From 7c5f097d9cc59c0a2087ccc65f54a8d6dd07dde4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:26:23 +0000 Subject: import acpid-2.0.19-8.el7 --- diff --git a/SOURCES/acpid-2.0.19-dynamic-connections.patch b/SOURCES/acpid-2.0.19-dynamic-connections.patch new file mode 100644 index 0000000..fdd9dd0 --- /dev/null +++ b/SOURCES/acpid-2.0.19-dynamic-connections.patch @@ -0,0 +1,94 @@ +--- a/acpid.c ++++ a/acpid.c +@@ -456,6 +456,7 @@ void + clean_exit_with_status(int status) + { + acpid_cleanup_rules(1); ++ delete_all_connections(); + acpid_log(LOG_NOTICE, "exiting"); + unlink(pidfile); + exit(status); +--- a/connection_list.c ++++ a/connection_list.c +@@ -35,9 +35,9 @@ + /*---------------------------------------------------------------*/ + /* private objects */ + +-#define MAX_CONNECTIONS 20 ++static int capacity = 0; + +-static struct connection connection_list[MAX_CONNECTIONS]; ++static struct connection *connection_list = NULL; + + static int nconnections = 0; + +@@ -56,12 +56,20 @@ add_connection(struct connection *p) + { + if (nconnections < 0) + return; +- if (nconnections >= MAX_CONNECTIONS) { +- acpid_log(LOG_ERR, "Too many connections."); +- /* ??? This routine should return -1 in this situation so that */ +- /* callers can clean up any open fds and whatnot. */ +- return; +- } ++ ++ /* if the list is full, allocate more space */ ++ if (nconnections >= capacity) { ++ /* no more than 1024 */ ++ if (capacity > 1024) { ++ acpid_log(LOG_ERR, "Too many connections."); ++ return; ++ } ++ ++ /* another 20 */ ++ capacity += 20; ++ connection_list = ++ realloc(connection_list, sizeof(struct connection) * capacity); ++ } + + if (nconnections == 0) + FD_ZERO(&allfds); +@@ -82,7 +89,9 @@ delete_connection(int fd) + { + int i; + +- close(fd); ++ /* close anything other than stdin/stdout/stderr */ ++ if (fd > 2) ++ close(fd); + + /* remove from the fd set */ + FD_CLR(fd, &allfds); +@@ -110,6 +119,21 @@ delete_connection(int fd) + + /*---------------------------------------------------------------*/ + ++void ++delete_all_connections(void) ++{ ++ /* while there are still connections to delete */ ++ while (nconnections) { ++ /* delete the connection at the end of the list */ ++ delete_connection(connection_list[nconnections-1].fd); ++ } ++ ++ free(connection_list); ++ connection_list = NULL; ++} ++ ++/*---------------------------------------------------------------*/ ++ + struct connection * + find_connection(int fd) + { +--- a/connection_list.h ++++ a/connection_list.h +@@ -75,4 +75,7 @@ extern const fd_set *get_fdset(void); + /* get the highest fd that was added to the list */ + extern int get_highestfd(void); + ++/* delete all connections, closing the fds */ ++extern void delete_all_connections(void); ++ + #endif /* CONNECTION_LIST_H__ */ diff --git a/SPECS/acpid.spec b/SPECS/acpid.spec index 3651bec..ddd9b46 100644 --- a/SPECS/acpid.spec +++ b/SPECS/acpid.spec @@ -8,7 +8,7 @@ Summary: ACPI Event Daemon Name: acpid Version: 2.0.19 -Release: 6%{?dist} +Release: 8%{?dist} License: GPLv2+ Group: System Environment/Daemons Source: http://downloads.sourceforge.net/acpid2/%{name}-%{version}.tar.xz @@ -18,6 +18,8 @@ Source3: acpid.power.conf Source4: acpid.power.sh Source5: acpid.service Source6: acpid.sysconfig +# backported from upstream +Patch0: acpid-2.0.19-dynamic-connections.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExclusiveArch: ia64 x86_64 %{ix86} aarch64 URL: http://sourceforge.net/projects/acpid2/ @@ -41,7 +43,7 @@ The acpid-sysvinit contains SysV initscript. %prep %setup -q - +%patch0 -p1 -b .dynamic-connections %build %configure @@ -94,18 +96,6 @@ rm -rf %{buildroot} %files sysvinit %attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/acpid -%pre -if [ "$1" = "2" ]; then - conflist=`ls %{_sysconfdir}/acpi/events/*.conf 2> /dev/null` - RETCODE=$? - if [ $RETCODE -eq 0 ]; then - for i in $conflist; do - rmdot=`echo $i | sed 's/.conf/conf/'` - mv $i $rmdot - done - fi -fi - %post %systemd_post %{name}.service @@ -115,15 +105,33 @@ fi %postun %systemd_postun_with_restart %{name}.service +%posttrans +# automatic name conversion for older customized configs +for f in %{_sysconfdir}/acpi/events/*.conf +do + [ -f "$f" ] && mv "$f" "${f/%.conf/conf}" &>/dev/null || : +done + %triggerun -- %{name} < 2.0.10-2 - /sbin/chkconfig --del acpid >/dev/null 2>&1 || : - /bin/systemctl try-restart acpid.service >/dev/null 2>&1 || : +/sbin/chkconfig --del acpid >/dev/null 2>&1 || : +/bin/systemctl try-restart acpid.service >/dev/null 2>&1 || : %triggerpostun -n %{name}-sysvinit -- %{name} < 2.0.10-2 - /sbin/chkconfig --add acpid >/dev/null 2>&1 || : +/sbin/chkconfig --add acpid >/dev/null 2>&1 || : %changelog +* Tue May 9 2017 Jaroslav Škarvada - 2.0.19-8 +- Fixed conversion scriptlet + Resolves: rhbz#1436320 + +* Tue Mar 21 2017 Jaroslav Škarvada - 2.0.19-7 +- Switched to dynamic connections (increased max connections from 20 to 1024) + Resolves: rhbz#1351999 +- Simplified conversion script and moved it to posttrans to get rid of warnings + during upgrade from RHEL-6 to RHEL-7 + Resolves: rhbz#1086686 + * Wed Sep 2 2015 Jaroslav Škarvada - 2.0.19-6 - Hardened build Resolves: rhbz#1092516