summaryrefslogtreecommitdiff
path: root/librt/shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'librt/shm.c')
-rw-r--r--librt/shm.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/librt/shm.c b/librt/shm.c
index f1ef0e708..f0a974059 100644
--- a/librt/shm.c
+++ b/librt/shm.c
@@ -71,13 +71,16 @@ int shm_open(const char *name, int oflag, mode_t mode)
#else
fd = open(shm_name, oflag, mode);
if (fd >= 0) {
- int fdflags = fcntl(fd, F_GETFD, 0);
- if (fdflags >= 0)
- fdflags = fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
- if (fdflags < 0) {
- close(fd);
- fd = -1;
- }
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+ // thus far, {G,S}ETFD only has this single flag,
+ // and setting it never fails.
+ //int fdflags = fcntl(fd, F_GETFD);
+ //if (fdflags >= 0)
+ // fdflags = fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
+ //if (fdflags < 0) {
+ // close(fd);
+ // fd = -1;
+ //}
}
#endif
old_errno = errno;