Xext/shm: Fix usage of F_GETFD to match standard

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@apple.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Jeremy Huddleston Sequoia 2016-09-11 19:47:47 -07:00
parent 7def2fea30
commit a5769de0f5

View File

@ -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);
}