summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-09-05 17:18:38 -0400
committerUlrich Drepper <drepper@gmail.com>2011-09-05 17:18:38 -0400
commit554881ef206db3e749602309fdb6b191e7ed09b4 (patch)
treed3dec576ad323401fe716e1dbc6b80ee8520b871 /elf
parentb0fc1ff04ee0775dbe1b5d6d4a2c87e2d7decb06 (diff)
downloadglibc-554881ef206db3e749602309fdb6b191e7ed09b4.tar.gz
glibc-554881ef206db3e749602309fdb6b191e7ed09b4.tar.xz
glibc-554881ef206db3e749602309fdb6b191e7ed09b4.zip
Use O_CLOEXEC when loading ld.so cache
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-misc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/elf/dl-misc.c b/elf/dl-misc.c
index d50537ade7..48310c0284 100644
--- a/elf/dl-misc.c
+++ b/elf/dl-misc.c
@@ -1,5 +1,5 @@
 /* Miscellaneous support functions for dynamic linker
-   Copyright (C) 1997-2004, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1997-2004, 2006, 2009, 2011 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
@@ -44,7 +44,11 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
 {
   void *result = MAP_FAILED;
   struct stat64 st;
-  int fd = __open (file, O_RDONLY);
+  int flags = O_RDONLY;
+#ifdef O_CLOEXEC
+  flags |= O_CLOEXEC;
+#endif
+  int fd = __open (file, flags);
   if (fd >= 0)
     {
       if (__fxstat64 (_STAT_VER, fd, &st) >= 0)
@@ -350,7 +354,7 @@ _dl_higher_prime_number (unsigned long int n)
     UINT32_C (536870909),
     UINT32_C (1073741789),
     UINT32_C (2147483647),
-                                       /* 4294967291L */
+				       /* 4294967291L */
     UINT32_C (2147483647) + UINT32_C (2147483644)
   };