gfile: Open files with CLOEXEC flag set

First try to atomically open the file using O_CLOEXEC for open()
and the "e" mode for fopen(), and if that doesn't work or O_CLOEXEC
isn't defined, fall back to opening the file first and applying
the FD_CLOEXEC flag afterwards.
1 file changed