diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-04-13 21:28:18 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-04-13 21:28:18 +0200 |
commit | a12ae89f860229cbe5ba91f1f9cf17cc5a9ede31 (patch) | |
tree | 3b22b435b0081a1f52f68db25d66b253d0b71337 | |
parent | 44500cbb25bc6e76723304b9ff39f875c04309f9 (diff) | |
download | glibc-a12ae89f860229cbe5ba91f1f9cf17cc5a9ede31.zip glibc-a12ae89f860229cbe5ba91f1f9cf17cc5a9ede31.tar.gz glibc-a12ae89f860229cbe5ba91f1f9cf17cc5a9ede31.tar.bz2 |
Assume that O_NOFOLLOW is always defined
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | csu/check_fds.c | 12 | ||||
-rw-r--r-- | elf/dl-profile.c | 7 | ||||
-rw-r--r-- | elf/rtld.c | 4 | ||||
-rw-r--r-- | gmon/gmon.c | 4 | ||||
-rw-r--r-- | sysdeps/posix/shm_open.c | 2 |
6 files changed, 15 insertions, 24 deletions
@@ -1,5 +1,15 @@ 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] Remove EDNS fallback. * resolv/res_query.c (__libc_res_nquery): Remove RES_F_EDNS0ERR diff --git a/csu/check_fds.c b/csu/check_fds.c index bec2a53..062c879 100644 --- a/csu/check_fds.c +++ b/csu/check_fds.c @@ -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); diff --git a/elf/dl-profile.c b/elf/dl-profile.c index 01aaf31..a4f1108 100644 --- a/elf/dl-profile.c +++ b/elf/dl-profile.c @@ -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]; @@ -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; diff --git a/gmon/gmon.c b/gmon/gmon.c index e9988c0..f394a78 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -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) { diff --git a/sysdeps/posix/shm_open.c b/sysdeps/posix/shm_open.c index aac0da4..56a9965 100644 --- a/sysdeps/posix/shm_open.c +++ b/sysdeps/posix/shm_open.c @@ -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 |