[RFC wayland 04/18] cursor: use wl_os_set_cloexec_or_close instead of local copy

Derek Foreman derekf at osg.samsung.com
Tue Feb 9 16:55:51 UTC 2016


Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 cursor/os-compatibility.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/cursor/os-compatibility.c b/cursor/os-compatibility.c
index 9791f97..6883a1d 100644
--- a/cursor/os-compatibility.c
+++ b/cursor/os-compatibility.c
@@ -35,30 +35,6 @@
 #include "config.h"
 #include "os-compatibility.h"
 
-#ifndef HAVE_MKOSTEMP
-static int
-set_cloexec_or_close(int fd)
-{
-	long flags;
-
-	if (fd == -1)
-		return -1;
-
-	flags = fcntl(fd, F_GETFD);
-	if (flags == -1)
-		goto err;
-
-	if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
-		goto err;
-
-	return fd;
-
-err:
-	close(fd);
-	return -1;
-}
-#endif
-
 static int
 create_tmpfile_cloexec(char *tmpname)
 {
@@ -71,7 +47,7 @@ create_tmpfile_cloexec(char *tmpname)
 #else
 	fd = mkstemp(tmpname);
 	if (fd >= 0) {
-		fd = set_cloexec_or_close(fd);
+		fd = wl_os_set_cloexec_or_close(fd);
 		unlink(tmpname);
 	}
 #endif
-- 
2.7.0



More information about the wayland-devel mailing list