]> git.ipfire.org Git - thirdparty/libbsd.git/commit
test: Close all descriptors before initializing them for closefrom()
authorGuillem Jover <guillem@hadrons.org>
Mon, 8 Jan 2024 00:58:54 +0000 (01:58 +0100)
committerGuillem Jover <guillem@hadrons.org>
Mon, 8 Jan 2024 00:58:54 +0000 (01:58 +0100)
commitdd0bdb58e0e5b3b811958a1f9ccd7da6d46c9581
tree1312293445310a7584dc3286d68e123ddf934b27
parent0813f3786f4968e4fca374fd7b74fb97a0f51f21
test: Close all descriptors before initializing them for closefrom()

On macOS, closefrom() only sets the close-on-exec flag, so we cannot
check whether all file descriptors were closed, which means that if
on entry our file descriptor table was filled after the 4th file
descriptor, then we might fail the assertions for the flags for odd
file descriptors which we expect to be closed.

This can easily happen when running the test suite in parallel mode
with «make -j8 check» for example.

Closes: #23
test/closefrom.c