From 04f3af9f69eff10d0d036c325aa31068793f156a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 8 Nov 1999 21:31:31 +0000 Subject: 1999-11-08 Roland McGrath * 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. --- libtrivfs/fsys-getroot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libtrivfs') 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 -- cgit v1.2.3