]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libc: Fix t_spawn_fileactions test after ATF update
authorAlex Richardson <arichardson@FreeBSD.org>
Thu, 18 Feb 2021 10:07:51 +0000 (10:07 +0000)
committerAlex Richardson <arichardson@FreeBSD.org>
Thu, 18 Feb 2021 14:02:47 +0000 (14:02 +0000)
commit2aa3ef285a23d802f0bd6c7281612e16834e9b68
treea47466d2880bb819b3f6ed06a283a2ec584ea9c1
parent1c808fcd859f5ce24132a903a4c7c9996e0513b1
libc: Fix t_spawn_fileactions test after ATF update

Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da
ATF opens the results file on startup. This fixes problems like
capsicumized tests not being able to open the file on exit.

However, this test closes all file descriptors above 3 to get a
deterministic fd table allocation for the child. Instead of using closefrom
(which will close the ATF output file FD) I've changed this test use
the lowest available fd and pass that to the helper program as a string.

We could also try to re-open the results file in ATF if we get a EBADF
error, but that will fail when running under Capsicum.

Reviewed By: cem
Differential Revision: https://reviews.freebsd.org/D28684
contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c
contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c