summaryrefslogtreecommitdiff
path: root/libstore/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'libstore/open.c')
-rw-r--r--libstore/open.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libstore/open.c b/libstore/open.c
index ebfe2d5c..ca3eb886 100644
--- a/libstore/open.c
+++ b/libstore/open.c
@@ -1,6 +1,6 @@
/* Store creation from a file name
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 97, 98 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -37,6 +37,13 @@ store_open (const char *name, int flags,
int open_flags = (flags & STORE_HARD_READONLY) ? O_RDONLY : O_RDWR;
file_t node = file_name_lookup (name, open_flags, 0);
+ if (node == MACH_PORT_NULL && !(flags & STORE_HARD_READONLY)
+ && (errno == EACCES || errno == EROFS))
+ {
+ flags |= STORE_HARD_READONLY;
+ node = file_name_lookup (name, O_RDONLY, 0);
+ }
+
if (node == MACH_PORT_NULL)
return errno;