3 ms·
you close the file descriptors in the child process to avoid interfering with the parent, you can do this automatically on execve if they are marked with FD_CLO
by the8472 7y ago
you close the file descriptors in the child process to avoid interfering with the parent, you can do this automatically on execve if they are marked with FD_CLOEXEC
or you simply avoid touching them. remember that forking only creates one new thread in the child process, there won't be any code running that you don't control or that would know about those file descriptors existing.