]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Assume that O_NOFOLLOW is always defined
authorFlorian Weimer <fweimer@redhat.com>
Thu, 13 Apr 2017 19:28:18 +0000 (21:28 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 13 Apr 2017 19:28:18 +0000 (21:28 +0200)
ChangeLog
csu/check_fds.c
elf/dl-profile.c
elf/rtld.c
gmon/gmon.c
sysdeps/posix/shm_open.c

index 9eec2703262b034c08eb9f2182f0b5266ad151d3..b209f9c8cc5b44c1abaaade996fb0698a26d55ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-04-13  Florian Weimer  <fweimer@redhat.com>
+
+       * csu/check_fds.c (__libc_check_standard_fds): Assume O_NOFOLLOW
+       is defined.
+       * elf/rtld.c (process_envvars): Likewise.
+       * sysdeps/posix/shm_open.c (shm_open): Likewise.
+       * elf/dl-profile.c (EXTRA_FLAGS): Remove definition.  Use
+       O_NOFOLLOW directly.
+       * gmon/gmon.c (O_NOFOLLOW): Remove definition.
+
 2017-04-13  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #21369]
index bec2a5372cbbaca462dd30491a7a324418077e73..062c879373208792f5d964fd827758520611a50b 100644 (file)
@@ -87,14 +87,10 @@ check_one_fd (int fd, int mode)
 void
 __libc_check_standard_fds (void)
 {
-  /* This is really paranoid but some people actually are.  If /dev/null
-     should happen to be a symlink to somewhere else and not the device
-     commonly known as "/dev/null" we bail out.  We can detect this with
-     the O_NOFOLLOW flag for open() but only on some system.  */
-#ifndef O_NOFOLLOW
-# define O_NOFOLLOW    0
-#endif
-  /* Check all three standard file descriptors.  */
+  /* Check all three standard file descriptors.  The O_NOFOLLOW flag
+     is really paranoid but some people actually are.  If /dev/null
+     should happen to be a symlink to somewhere else and not the
+     device commonly known as "/dev/null" we bail out.  */
   check_one_fd (STDIN_FILENO, O_WRONLY | O_NOFOLLOW);
   check_one_fd (STDOUT_FILENO, O_RDONLY | O_NOFOLLOW);
   check_one_fd (STDERR_FILENO, O_RDONLY | O_NOFOLLOW);
index 01aaf315a746d4c7988b418e52a75bfdb7a992dd..a4f11089a1f89e180445f1f6b16a936b5ee40204 100644 (file)
@@ -325,12 +325,7 @@ _dl_start_profile (void)
   *cp++ = '/';
   __stpcpy (__stpcpy (cp, GLRO(dl_profile)), ".profile");
 
-#ifdef O_NOFOLLOW
-# define EXTRA_FLAGS | O_NOFOLLOW
-#else
-# define EXTRA_FLAGS
-#endif
-  fd = __open (filename, O_RDWR | O_CREAT EXTRA_FLAGS, DEFFILEMODE);
+  fd = __open (filename, O_RDWR | O_CREAT | O_NOFOLLOW, DEFFILEMODE);
   if (fd == -1)
     {
       char buf[400];
index 5986eaf4a19e8227153d071887608d7607d110cd..319ef062d4b32cccc599486cbf5b1453b2fab076 100644 (file)
@@ -2525,11 +2525,7 @@ process_envvars (enum mode *modep)
      messages to this file.  */
   else if (any_debug && debug_output != NULL)
     {
-#ifdef O_NOFOLLOW
       const int flags = O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW;
-#else
-      const int flags = O_WRONLY | O_APPEND | O_CREAT;
-#endif
       size_t name_len = strlen (debug_output);
       char buf[name_len + 12];
       char *startp;
index e9988c06c4d3a5691848d41d03dc7ef391edaf59..f394a7870e7e04b6b788e0475cad8bff6ffae578 100644 (file)
@@ -336,10 +336,6 @@ write_gmon (void)
     int fd = -1;
     char *env;
 
-#ifndef O_NOFOLLOW
-# define O_NOFOLLOW    0
-#endif
-
     env = getenv ("GMON_OUT_PREFIX");
     if (env != NULL && !__libc_enable_secure)
       {
index aac0da41c21899fbe8cef168d5dded1244efc430..56a9965263b4c2cfa332ce90cde17d748fbea4c7 100644 (file)
@@ -34,9 +34,7 @@ shm_open (const char *name, int oflag, mode_t mode)
 {
   SHM_GET_NAME (EINVAL, -1, "");
 
-# ifdef O_NOFOLLOW
   oflag |= O_NOFOLLOW;
-# endif
 # ifdef O_CLOEXEC
   oflag |= O_CLOEXEC;
 # endif