[PATCH 1/3] Xext/shm: Fix usage of F_GETFD to match standard

Jeremy Huddleston Sequoia jeremyhu at apple.com
Mon Sep 12 03:01:49 UTC 2016


flags = fcntl(fd, F_GETFD) is compliant.

fcntl(fd, F_GETFD, &flags) is non-compliant (Linux extension?)

cf: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
---
 Xext/shm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Xext/shm.c b/Xext/shm.c
index 0557538..125000f 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1213,7 +1213,8 @@ shm_tmpfile(void)
 	if (fd < 0)
 		return -1;
 	unlink(template);
-	if (fcntl(fd, F_GETFD, &flags) >= 0) {
+	flags = fcntl(fd, F_GETFD);
+	if (flags != -1) {
 		flags |= FD_CLOEXEC;
 		(void) fcntl(fd, F_SETFD, &flags);
 	}
-- 
2.10.0 (Apple Git-99)



More information about the xorg-devel mailing list