summaryrefslogtreecommitdiff
path: root/dbus
diff options
context:
space:
mode:
authorWilliam Earley <nitrous@sourt.in>2020-09-27 12:24:30 +0100
committerSimon McVittie <smcv@collabora.com>2020-11-06 15:10:42 +0000
commit691946dabcdd3e97787655d977a4da33fe56d433 (patch)
tree68f8e6f36b8d693e339ce0c91cdb9454db32c5ec /dbus
parent49d924ba561441c91eef1954013625d6b85891ba (diff)
downloaddbus-691946dabcdd3e97787655d977a4da33fe56d433.tar.gz
sysdeps: Don't raise RLIMIT_NOFILE beyond OPEN_MAX on macOS
dbus-daemon fails to launch on macOS 10.5 and above because of a breaking change in setrlimit, in which RLIM_INFINITY is no longer supported for RLIMIT_NOFILE. Instead we must use OPEN_MAX. Resolves: #309
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-sysdeps-util-unix.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index d29cbd1f..878ca2ea 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -458,7 +458,14 @@ _dbus_rlimit_raise_fd_limit (DBusError *error)
* and older and non-systemd Linux systems would typically set rlim_cur
* to 1024 and rlim_max to 4096. */
if (lim.rlim_max == RLIM_INFINITY || lim.rlim_cur < lim.rlim_max)
- lim.rlim_cur = lim.rlim_max;
+ {
+#if defined(__APPLE__) && defined(__MACH__)
+ /* macOS 10.5 and above no longer allows RLIM_INFINITY for rlim_cur */
+ lim.rlim_cur = MIN (OPEN_MAX, lim.rlim_max);
+#else
+ lim.rlim_cur = lim.rlim_max;
+#endif
+ }
/* Early-return if there is nothing to do. */
if (lim.rlim_max == old.rlim_max &&