I ran into this issue when running tests for the MacPorts port of oath-toolkit (https://ports.macports.org/port/oath-toolkit/) on Mac OS 10.14.6. I don't know the specific reason, but it seems like the test process inherits a lot of open files from its parent, as the actual fd returned by fcntl is 67.
Closing fd 10 is a good suggestion, as it's simpler than having to convert the fd to/from a string to pass it to the child process. I updated the patch file with this approach. > On May 8, 2021, at 7:03 PM, Bruno Haible <br...@clisp.org> wrote: > > Hi, > > Nicholas Gaya wrote: >> fd 10 is already in use (which happens to be the case in the testing >> environment where I ran into this bug) > > 3 questions: > 1) What is this environment that leaves fd 10 open when it starts a process? > 2) For which purpose does it use this fd? > 3) What would happen if we close fd 10 in test-fcntl.c? > > Bruno >