From 21a8a27ca3c6840a5420aa1b6c0ebf9acff07f46 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 26 Dec 1998 20:37:25 +0000 Subject: 1998-12-21 Roland McGrath * open.c (store_open): Like file.c:fiopen, catch EACCES or EROFS and try to open read-only. --- libstore/open.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 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; -- cgit v1.2.3