devel/dbus: use closefrom()
Don't do 1021 calls to close() when a single closefrom() will do. This patch has been submitted upstream (by the reporter) but is languishing there; there's a big difference between upstream's development branch and the released stable version. I've taken the initial patch from FreeBSD bugzilla, lightly mutated it with upstream work. PR: 240549 Reported by: rozhuk.im@gmail.com
This commit is contained in:
parent
ec8a052e5d
commit
aee4556063
@ -2,7 +2,7 @@
|
||||
|
||||
PORTNAME= dbus
|
||||
DISTVERSION= 1.12.20
|
||||
PORTREVISION= 3
|
||||
PORTREVISION= 4
|
||||
CATEGORIES= devel gnome
|
||||
MASTER_SITES= http://dbus.freedesktop.org/releases/dbus/
|
||||
|
||||
|
10
devel/dbus/files/patch-cmake_ConfigureChecks.cmake
Normal file
10
devel/dbus/files/patch-cmake_ConfigureChecks.cmake
Normal file
@ -0,0 +1,10 @@
|
||||
--- cmake/ConfigureChecks.cmake.orig 2018-02-23 10:25:17 UTC
|
||||
+++ cmake/ConfigureChecks.cmake
|
||||
@@ -47,6 +47,7 @@ check_symbol_exists(getpwnam_r "errno.h pwd.h" HA
|
||||
check_symbol_exists(setenv "stdlib.h" HAVE_SETENV) # dbus-sysdeps.c
|
||||
check_symbol_exists(unsetenv "stdlib.h" HAVE_UNSETENV) # dbus-sysdeps.c
|
||||
check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV) # dbus-sysdeps.c
|
||||
+check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) # dbus-sysdeps-unix.c
|
||||
check_symbol_exists(writev "sys/uio.h" HAVE_WRITEV) # dbus-sysdeps.c, dbus-sysdeps-win.c
|
||||
check_symbol_exists(setrlimit "sys/resource.h" HAVE_SETRLIMIT) # dbus-sysdeps.c, dbus-sysdeps-win.c, test/test-segfault.c
|
||||
check_symbol_exists(socketpair "sys/socket.h" HAVE_SOCKETPAIR) # dbus-sysdeps.c
|
12
devel/dbus/files/patch-cmake_config.h.cmake
Normal file
12
devel/dbus/files/patch-cmake_config.h.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
--- cmake/config.h.cmake.orig 2018-02-23 10:25:17 UTC
|
||||
+++ cmake/config.h.cmake
|
||||
@@ -181,6 +181,9 @@
|
||||
/* Define to 1 if you have clearenv */
|
||||
#cmakedefine HAVE_CLEARENV 1
|
||||
|
||||
+/* Define to 1 if you have closefrom */
|
||||
+#cmakedefine HAVE_CLOSEFROM 1
|
||||
+
|
||||
/* Define to 1 if you have writev */
|
||||
#cmakedefine HAVE_WRITEV 1
|
||||
|
21
devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c
Normal file
21
devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c
Normal file
@ -0,0 +1,21 @@
|
||||
--- dbus/dbus-sysdeps-unix.c.orig 2020-07-02 09:08:39 UTC
|
||||
+++ dbus/dbus-sysdeps-unix.c
|
||||
@@ -4469,6 +4469,10 @@ _dbus_socket_can_pass_unix_fd (DBusSocket fd)
|
||||
void
|
||||
_dbus_close_all (void)
|
||||
{
|
||||
+#ifdef __FreeBSD__
|
||||
+ closefrom(3);
|
||||
+#else
|
||||
+#error Expected to be FreeBSD with closefrom()
|
||||
int maxfds, i;
|
||||
|
||||
#ifdef __linux__
|
||||
@@ -4525,6 +4528,7 @@ _dbus_close_all (void)
|
||||
/* close all inherited fds */
|
||||
for (i = 3; i < maxfds; i++)
|
||||
close (i);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**
|
Loading…
Reference in New Issue
Block a user