diff options
author | Joan Bruguera Micó <joanbrugueram@gmail.com> | 2024-06-04 13:14:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-06-05 13:37:05 (GMT) |
commit | ff077af0320611abf024d2c4d05baecb71de705c (patch) | |
tree | 5f84fd19fb76b5334868ccbbc820ea3f1701f268 /Source | |
parent | efaa9efece0786a80243d005e35e68f18999eb0e (diff) | |
download | CMake-ff077af0320611abf024d2c4d05baecb71de705c.zip CMake-ff077af0320611abf024d2c4d05baecb71de705c.tar.gz CMake-ff077af0320611abf024d2c4d05baecb71de705c.tar.bz2 |
ctest: Set close-on-exec for jobserver FIFO
Set the close-on-exec flag to prevent the jobserver FIFO file
descriptor from leaking to subprocesses spawned by `ctest`.
This leak is usually harmless, but can cause `make test -jN` to hang
at the end of the build if a test leaves a background process running
with the jobserver FIFO file descriptor open.
Fixes: #26027
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmUVJobServerClient.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/CTest/cmUVJobServerClient.cxx b/Source/CTest/cmUVJobServerClient.cxx index d7d76c9..055b29b 100644 --- a/Source/CTest/cmUVJobServerClient.cxx +++ b/Source/CTest/cmUVJobServerClient.cxx @@ -306,6 +306,10 @@ void ImplPosix::ConnectFIFO(const char* path) if (fd < 0) { return; } + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { + close(fd); + return; + } cm::uv_pipe_ptr connFIFO; connFIFO.init(this->Loop, 0, this); |