int XdevLWindowWayland::createTmpFileCloExec(char *tmpname) { int fd; #ifdef HAVE_MKOSTEMP fd = mkostemp(tmpname, O_CLOEXEC); if(fd >= 0) unlink(tmpname); #else fd = mkstemp(tmpname); if(fd >= 0) { fd = setCloexecOrClose(fd); unlink(tmpname); } #endif return fd; }
static int createTmpFileCloexec(char *tmpname) { int fd; #ifdef HAVE_MKOSTEMP fd = mkostemp(tmpname, O_CLOEXEC); if (fd >= 0){ unlink(tmpname); } #else fd = mkstemp(tmpname); if (fd >= 0){ fd = setCloexecOrClose(fd); unlink(tmpname); } #endif return fd; }