mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-03-22 12:40:37 +01:00
tests: Only check whether the first 1024 fds are close-on-exec
On recent Linux systems, systemd sets the hard limit on the number of file descriptors extremely high (about 1e9, compared with about 1e6 in previous systemd versions or 4096 in the kernel's historical defaults), and dbus raises its soft limit to match the hard limit. The result of sysconf(_SC_OPEN_MAX) is based on the fd limit, and iterating linearly through that many fds takes long enough for activation to time out. This particular piece of code is just test instrumentation, which aims to log (possibly fatal) warnings if any file descriptor is not close-on-exec as it should be. In practice the test suite doesn't use anywhere near a thousand fds, so it's sufficient to run this check against a much smaller number of fds. Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/527 Bug-Debian: https://bugs.debian.org/1086148 Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
4e8973398f
commit
6946489326
1 changed files with 6 additions and 0 deletions
|
|
@ -1055,6 +1055,12 @@ do_exec (int child_err_report_fd,
|
|||
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
|
||||
max_open = sysconf (_SC_OPEN_MAX);
|
||||
|
||||
/* Because fds are allocated as numerically small as possible, we don't
|
||||
* need to check the entire fd space, which can be prohibitively slow if
|
||||
* the fd limit is very high. */
|
||||
if (max_open > 1024)
|
||||
max_open = 1024;
|
||||
|
||||
for (i = 3; i < max_open; i++)
|
||||
{
|
||||
int retval;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue