Exemplo n.º 1
0
	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;
	}
Exemplo n.º 2
0
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;
}