git: aee4556063e8 - main - devel/dbus: use closefrom()
Adriaan de Groot
adridg at FreeBSD.org
Fri May 14 19:08:21 UTC 2021
The branch main has been updated by adridg:
URL: https://cgit.FreeBSD.org/ports/commit/?id=aee4556063e8770fd0e4fd28a29f30626d6e235a
commit aee4556063e8770fd0e4fd28a29f30626d6e235a
Author: Adriaan de Groot <adridg at FreeBSD.org>
AuthorDate: 2021-05-13 22:57:15 +0000
Commit: Adriaan de Groot <adridg at FreeBSD.org>
CommitDate: 2021-05-14 19:08:18 +0000
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 at gmail.com
---
devel/dbus/Makefile | 2 +-
devel/dbus/files/patch-cmake_ConfigureChecks.cmake | 10 ++++++++++
devel/dbus/files/patch-cmake_config.h.cmake | 12 ++++++++++++
devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c | 21 +++++++++++++++++++++
4 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/devel/dbus/Makefile b/devel/dbus/Makefile
index b8f9b271bf70..c2558176d6d5 100644
--- a/devel/dbus/Makefile
+++ b/devel/dbus/Makefile
@@ -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/
diff --git a/devel/dbus/files/patch-cmake_ConfigureChecks.cmake b/devel/dbus/files/patch-cmake_ConfigureChecks.cmake
new file mode 100644
index 000000000000..984ee5ad0738
--- /dev/null
+++ b/devel/dbus/files/patch-cmake_ConfigureChecks.cmake
@@ -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
diff --git a/devel/dbus/files/patch-cmake_config.h.cmake b/devel/dbus/files/patch-cmake_config.h.cmake
new file mode 100644
index 000000000000..9cb0e65dfbe8
--- /dev/null
+++ b/devel/dbus/files/patch-cmake_config.h.cmake
@@ -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
+
diff --git a/devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c b/devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c
new file mode 100644
index 000000000000..d73b90e48357
--- /dev/null
+++ b/devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c
@@ -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
+ }
+
+ /**
More information about the dev-commits-ports-all
mailing list