summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2020-12-18 09:36:30 -0500
committerAdam Jackson <ajax@redhat.com>2020-12-18 09:36:30 -0500
commit365cbbfc4b99f7d9937d1b8b61f1483556a5b57a (patch)
tree94a771d01ca052bcf7d9d6e3270f96360b14e510
parent5e3900904ddc27f3d5580ce3a07929469d82fb5e (diff)
os, shm: fcntl()'s third argument is integer, not pointer
All of these uses were attempting to set FD_CLOEXEC, which happens to be (1<<0). Since flags is going to be aligned in memory, its address is never going to have the low bit set, so we were never actually setting what we meant to. Fixes: xorg/xserver#1114
-rw-r--r--Xext/shm.c2
-rw-r--r--os/inputthread.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/Xext/shm.c b/Xext/shm.c
index 0deb9a945..071bd1a41 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1248,7 +1248,7 @@ shm_tmpfile(void)
int flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
- (void) fcntl(fd, F_SETFD, &flags);
+ (void) fcntl(fd, F_SETFD, flags);
}
#endif
return fd;
diff --git a/os/inputthread.c b/os/inputthread.c
index 361d96efa..3469cfc1c 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -427,7 +427,7 @@ InputThreadPreInit(void)
flags = fcntl(inputThreadInfo->readPipe, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
- (void)fcntl(inputThreadInfo->readPipe, F_SETFD, &flags);
+ (void)fcntl(inputThreadInfo->readPipe, F_SETFD, flags);
}
SetNotifyFd(inputThreadInfo->readPipe, InputThreadNotifyPipe, X_NOTIFY_READ, NULL);
@@ -438,7 +438,7 @@ InputThreadPreInit(void)
flags = fcntl(hotplugPipeRead, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
- (void)fcntl(hotplugPipeRead, F_SETFD, &flags);
+ (void)fcntl(hotplugPipeRead, F_SETFD, flags);
}
hotplugPipeWrite = hotplugPipe[1];