Use CLOEXEC for files and sockets
Fix compilation with GCC