Hello,

I believe I have found a bug in gnulib's test-fcntl.c. In order to test the 
functionality of fcntl with FD_DUPFD_CLOEXEC, the test dups an open file 
descriptor using the flag and execs a child process to check that the file 
descriptor gets closed on exec. The problem is that the current test code 
assumes that the duplicated file descriptor will have constant value 10, which 
will not be true if fd 10 is already in use (which happens to be the case in 
the testing environment where I ran into this bug).

To fix this, we can pass the file descriptor returned by fcntl as an argument 
to the child process. Please see this proposed patch for details: 
https://gist.github.com/nickgaya/2a70ebdce8c020481d3e5b6c3696fe7b

Best,
Nicholas Gaya

Reply via email to