about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-10-06 15:36:23 +0000
committerUlrich Drepper <drepper@redhat.com>2005-10-06 15:36:23 +0000
commit31d12f6cad54d11fd6d468085050b1c6581fb03c (patch)
treef041c2b135c6d76176a98775f76a7b0e8bd36b4a /sysdeps
parent008feb8587a1d16d9ef1e1a67202e4dd5dfe1d47 (diff)
downloadglibc-31d12f6cad54d11fd6d468085050b1c6581fb03c.tar.gz
glibc-31d12f6cad54d11fd6d468085050b1c6581fb03c.tar.xz
glibc-31d12f6cad54d11fd6d468085050b1c6581fb03c.zip
Allow fopen to fail because the file does not exist.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/readonly-area.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/readonly-area.c b/sysdeps/unix/sysv/linux/readonly-area.c
index ce5321bcef..94e88bcb6f 100644
--- a/sysdeps/unix/sysv/linux/readonly-area.c
+++ b/sysdeps/unix/sysv/linux/readonly-area.c
@@ -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);