aboutsummaryrefslogtreecommitdiff
path: root/nss/nss_files
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 /nss/nss_files
parentb48061e1a534a2421c65e4258418d41a5335ba32 (diff)
downloadglibc-cef9b65376a044309f74b77860ccf3c48a4ae315.zip
glibc-cef9b65376a044309f74b77860ccf3c48a4ae315.tar.gz
glibc-cef9b65376a044309f74b77860ccf3c48a4ae315.tar.bz2
Assume that O_CLOEXEC is always defined and works
Diffstat (limited to 'nss/nss_files')
-rw-r--r--nss/nss_files/files-XXX.c35
-rw-r--r--nss/nss_files/files-alias.c35
-rw-r--r--nss/nss_files/files-have_o_cloexec.c23
3 files changed, 0 insertions, 93 deletions
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index dbd38a3..265331e 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -78,41 +78,6 @@ internal_setent (FILE **stream)
if (*stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
- else
- {
-#if !defined O_CLOEXEC || !defined __ASSUME_O_CLOEXEC
-# ifdef O_CLOEXEC
- if (__have_o_cloexec <= 0)
-# endif
- {
- /* We have to make sure the file is `closed on exec'. */
- int result;
- int flags;
-
- result = flags = fcntl (fileno (*stream), F_GETFD, 0);
- if (result >= 0)
- {
-# ifdef O_CLOEXEC
- if (__have_o_cloexec == 0)
- __have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1;
- if (__have_o_cloexec < 0)
-# endif
- {
- flags |= FD_CLOEXEC;
- result = fcntl (fileno (*stream), F_SETFD, flags);
- }
- }
- if (result < 0)
- {
- /* Something went wrong. Close the stream and return a
- failure. */
- fclose (*stream);
- *stream = NULL;
- status = NSS_STATUS_UNAVAIL;
- }
- }
-#endif
- }
}
else
rewind (*stream);
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index de4e364..cf872bb 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -51,41 +51,6 @@ internal_setent (FILE **stream)
if (*stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
- else
- {
-#if !defined O_CLOEXEC || !defined __ASSUME_O_CLOEXEC
-# ifdef O_CLOEXEC
- if (__have_o_cloexec <= 0)
-# endif
- {
- /* We have to make sure the file is `closed on exec'. */
- int result;
- int flags;
-
- result = flags = fcntl (fileno (*stream), F_GETFD, 0);
- if (result >= 0)
- {
-# ifdef O_CLOEXEC
- if (__have_o_cloexec == 0)
- __have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1;
- if (__have_o_cloexec < 0)
-# endif
- {
- flags |= FD_CLOEXEC;
- result = fcntl (fileno (*stream), F_SETFD, flags);
- }
- }
- if (result < 0)
- {
- /* Something went wrong. Close the stream and return a
- failure. */
- fclose (*stream);
- stream = NULL;
- status = NSS_STATUS_UNAVAIL;
- }
- }
-#endif
- }
}
else
rewind (*stream);
diff --git a/nss/nss_files/files-have_o_cloexec.c b/nss/nss_files/files-have_o_cloexec.c
deleted file mode 100644
index 295eccc..0000000
--- a/nss/nss_files/files-have_o_cloexec.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 2007-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <fcntl.h>
-#include <kernel-features.h>
-
-#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC
-int __have_o_cloexec;
-#endif