]> sourceware.org Git - glibc.git/commitdiff
Allow fopen to fail because the file does not exist.
authorUlrich Drepper <drepper@redhat.com>
Thu, 6 Oct 2005 15:36:23 +0000 (15:36 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 6 Oct 2005 15:36:23 +0000 (15:36 +0000)
sysdeps/unix/sysv/linux/readonly-area.c

index ce5321bcef41498444253af875b67cce6fd95c22..94e88bcb6f0124ce7986597d1e31aea38b10e4a6 100644 (file)
@@ -16,6 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdio_ext.h>
@@ -33,7 +34,14 @@ __readonly_area (const char *ptr, size_t size)
 
   FILE *fp = fopen ("/proc/self/maps", "rc");
   if (fp == NULL)
-    return -1;
+    {
+      if (errno == ENOENT)
+       /* It is the system administrator's choice to not have /proc
+          available to this process (e.g., because it runs in a chroot
+          environment.  Don't fail in this case.  */
+       return 1;
+      return -1;
+    }
 
   /* We need no locking.  */
   __fsetlocking (fp, FSETLOCKING_BYCALLER);
This page took 0.041712 seconds and 5 git commands to generate.