HomeFreeBSD

libc: Fix t_spawn_fileactions test after ATF update

Description

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

(cherry picked from commit 2aa3ef285a23d802f0bd6c7281612e16834e9b68)

Details

Provenance
arichardsonAuthored on Feb 18 2021, 10:07 AM
Reviewer
cem
Differential Revision
D28684: libc: Fix t_spawn_fileactions test after ATF update
Parents
rGd97a4cb221d5: Fix two failing tests after ATF update
Branches
Unknown
Tags
Unknown