summaryrefslogtreecommitdiff
path: root/libtrivfs/fsys-getroot.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-11-08 21:31:31 +0000
committerRoland McGrath <roland@gnu.org>1999-11-08 21:31:31 +0000
commit04f3af9f69eff10d0d036c325aa31068793f156a (patch)
tree9c1911d6210641a259081820d5adee021bc99034 /libtrivfs/fsys-getroot.c
parentbe2b418c98f9ec867e0b90580b2a7d77a241090a (diff)
1999-11-08 Roland McGrath <roland@baalperazim.frob.com>
* fsys-getroot.c (trivfs_S_fsys_getroot): Return EROFS or EACCES for a disallowed open attempt, instead of EOPNOTSUPP. EOPNOTSUPP results in the confusing result of ENOTDIR being delivered to the user.
Diffstat (limited to 'libtrivfs/fsys-getroot.c')
-rw-r--r--libtrivfs/fsys-getroot.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libtrivfs/fsys-getroot.c b/libtrivfs/fsys-getroot.c
index ed23dd94..6a8a679b 100644
--- a/libtrivfs/fsys-getroot.c
+++ b/libtrivfs/fsys-getroot.c
@@ -58,9 +58,11 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
return err;
}
- if ((flags & (O_READ|O_WRITE|O_EXEC) & trivfs_allow_open)
+ if ((flags & O_WRITE & trivfs_allow_open) != (flags & O_WRITE))
+ return EROFS;
+ if ((flags & (O_READ_WRITE|O_EXEC) & trivfs_allow_open)
!= (flags & (O_READ|O_WRITE|O_EXEC)))
- return EOPNOTSUPP;
+ return EACCES;
/* O_CREAT and O_EXCL are not meaningful here; O_NOLINK and O_NOTRANS
will only be useful when trivfs supports translators (which it doesn't