summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJoan Bruguera Micó <joanbrugueram@gmail.com>2024-06-04 13:14:21 (GMT)
committerBrad King <brad.king@kitware.com>2024-06-05 13:37:05 (GMT)
commitff077af0320611abf024d2c4d05baecb71de705c (patch)
tree5f84fd19fb76b5334868ccbbc820ea3f1701f268 /Source
parentefaa9efece0786a80243d005e35e68f18999eb0e (diff)
downloadCMake-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.cxx4
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);