aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-04-18 14:56:51 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-04-18 14:56:51 +0200
commitcef9b65376a044309f74b77860ccf3c48a4ae315 (patch)
treec934a9b57903468b9a2754c1cf8f99f2a94c9269 /libio
parentb48061e1a534a2421c65e4258418d41a5335ba32 (diff)
downloadglibc-cef9b65376a044309f74b77860ccf3c48a4ae315.tar
glibc-cef9b65376a044309f74b77860ccf3c48a4ae315.tar.gz
glibc-cef9b65376a044309f74b77860ccf3c48a4ae315.tar.bz2
glibc-cef9b65376a044309f74b77860ccf3c48a4ae315.zip
Assume that O_CLOEXEC is always defined and works
Diffstat (limited to 'libio')
-rw-r--r--libio/fileops.c16
-rw-r--r--libio/iopopen.c2
2 files changed, 0 insertions, 18 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index f12ed16e30..c55e196dd8 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -321,9 +321,7 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
fp->_flags2 |= _IO_FLAGS2_NOTCANCEL;
continue;
case 'e':
-#ifdef O_CLOEXEC
oflags |= O_CLOEXEC;
-#endif
fp->_flags2 |= _IO_FLAGS2_CLOEXEC;
continue;
default:
@@ -338,20 +336,6 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
if (result != NULL)
{
-#ifndef __ASSUME_O_CLOEXEC
- if ((fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0)
- {
- int fd = _IO_fileno (fp);
- if (__have_o_cloexec == 0)
- {
- int flags = __fcntl (fd, F_GETFD);
- __have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1;
- }
- if (__have_o_cloexec < 0)
- __fcntl (fd, F_SETFD, FD_CLOEXEC);
- }
-#endif
-
/* Test whether the mode string specifies the conversion. */
cs = strstr (last_recognized + 1, ",ccs=");
if (cs != NULL)
diff --git a/libio/iopopen.c b/libio/iopopen.c
index 95a12c90b5..b78e7e5ef2 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -173,12 +173,10 @@ _IO_new_proc_open (_IO_FILE *fp, const char *command, const char *mode)
if (child_end != child_std_end)
_IO_dup2 (child_end, child_std_end);
-#ifdef O_CLOEXEC
else
/* The descriptor is already the one we will use. But it must
not be marked close-on-exec. Undo the effects. */
__fcntl (child_end, F_SETFD, 0);
-#endif
/* POSIX.2: "popen() shall ensure that any streams from previous
popen() calls that remain open in the parent process are closed
in the new child process." */