Create files with O_CLOEXEC flag
Recent Unix'es support a O_CLOEXEC flag to open(), which avoids the potential race condition between opening and setting close-on-exec with fcntl() (and of course, one syscall less). The attached patch does this for a few cases. There are still many more places where this approach could be used; for sockets there is also the Linux-specific SOCK_CLOEXEC flag.
Please register or sign in to comment