git » libjio » commit 37d581e

Fix check for read-only access in jopen().

author Alberto Bertogli
2005-12-04 19:34:39 UTC
committer Alberto Bertogli
2007-07-15 13:50:38 UTC
parent 31b66b7cf639df6becdd0333d6d4d7fb0c8d4e46

Fix check for read-only access in jopen().

As a comment right above says, checking for read-only access can't be done by
"if (flags & O_RDONLY)" since O_RDONLY is usually 0. We test jflags & J_RDONLY
instead because we know it's properly defined.

Thanks to Brian Moyle for reporting this bug and providing a slightly
different patch.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

trans.c +1 -1

diff --git a/trans.c b/trans.c
index dcf68e3..e1f33d0 100644
--- a/trans.c
+++ b/trans.c
@@ -594,7 +594,7 @@ int jopen(struct jfs *fs, const char *name, int flags, int mode, int jflags)
 		goto error_exit;
 
 	/* nothing else to do for read-only access */
-	if (flags & O_RDONLY) {
+	if (jflags & J_RDONLY) {
 		return fs->fd;
 	}