[PATCH 2/3] Xext/shm: Better support cases where O_CLOEXEC is not defined
Jeremy Huddleston Sequoia
jeremyhu at apple.com
Mon Sep 12 03:01:50 UTC 2016
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
---
Xext/shm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Xext/shm.c b/Xext/shm.c
index 125000f..7a45dbd 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1202,7 +1202,11 @@ shm_tmpfile(void)
int flags;
char template[] = SHMDIR "/shmfd-XXXXXX";
#ifdef O_TMPFILE
- fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
+ flags = O_TMPFILE|O_RDWR|O_EXCL;
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
+ fd = open(SHMDIR, flags, 0666);
if (fd >= 0) {
ErrorF ("Using O_TMPFILE\n");
return fd;
--
2.10.0 (Apple Git-99)
More information about the xorg-devel
mailing list