about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-26 05:50:51 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-26 05:50:51 +0000
commit5f2de3379caae38ce49b6db1331105d6bd162316 (patch)
tree6f293d266617dcf5a60bd73633b004d95702080a /elf/rtld.c
parent6c163862c4e1322dacb9e6aa54e79c09a8aada63 (diff)
downloadglibc-5f2de3379caae38ce49b6db1331105d6bd162316.tar.gz
glibc-5f2de3379caae38ce49b6db1331105d6bd162316.tar.xz
glibc-5f2de3379caae38ce49b6db1331105d6bd162316.zip
Update.
	* elf/rtld.c (process_envvars): Open debug output file with O_NOFOLLOW.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index b2c9f5dc20..18ff312baa 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1497,6 +1497,11 @@ process_envvars (enum mode *modep, int *lazyp)
      messages to this file.  */
   if (any_debug && debug_output != NULL && !__libc_enable_secure)
     {
+#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;
@@ -1506,7 +1511,7 @@ process_envvars (enum mode *modep, int *lazyp)
       *--startp = '.';
       startp = memcpy (startp - name_len, debug_output, name_len);
 
-      _dl_debug_fd = __open (startp, O_WRONLY | O_APPEND | O_CREAT, 0666);
+      _dl_debug_fd = __open (startp, flags, 0666);
       if (_dl_debug_fd == -1)
 	/* We use standard output if opening the file failed.  */
 	_dl_debug_fd = STDOUT_FILENO;