If the test-bus test is run under Valgrind, its code to detect FD leaks
accidentally writes off the end of the fd_set it uses, as Valgrind opens
some high FDs (≥1024) for internal use.
Ignore those FDs. Realistically, they are never going to be leaks — in
order to have a false negative from omitting this check, D-Bus would
have to allocate and not leak all the FDs up to FD_SETSIZE, and then
leak the first FD over that which it allocated. D-Bus never allocates
anywhere near that number of FDs concurrently.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99839
if (fd == dirfd (d))
continue;
+ if (fd >= FD_SETSIZE)
+ {
+ _dbus_verbose ("FD %d unexpectedly large; cannot track whether "
+ "it is leaked\n", fd);
+ continue;
+ }
+
FD_SET (fd, &fds->set);
}
if (fd == dirfd (d))
continue;
+ if (fd >= FD_SETSIZE)
+ {
+ _dbus_verbose ("FD %d unexpectedly large; cannot track whether "
+ "it is leaked\n", fd);
+ continue;
+ }
+
if (FD_ISSET (fd, &fds->set))
continue;