
We always need to open the file with both read and write access: we use read
because we need to get the current contents before commiting a transaction,
and write because of fcntl locking.



---

 cur-root/trans.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff -puN trans.c~open_always_rw trans.c
--- cur/trans.c~open_always_rw	2004-06-19 23:57:44.353521232 -0300
+++ cur-root/trans.c	2004-06-19 23:57:44.355520928 -0300
@@ -437,12 +437,12 @@ int jopen(struct jfs *fs, const char *na
 	char jdir[PATH_MAX], jlockfile[PATH_MAX];
 	struct stat sinfo;
 
-	/* we always need read access, because when we commit a transaction we
-	 * read the current contents before applying */
-	if (flags & O_WRONLY) {
-		flags = flags & ~O_WRONLY;
-		flags = flags | O_RDWR;
-	}
+	/* we always need read and write access, because when we commit a
+	 * transaction we read the current contents before applying, and write
+	 * access is needed for locking with fcntl */
+	flags = flags & ~O_WRONLY;
+	flags = flags & ~O_RDONLY;
+	flags = flags | O_RDWR;
 
 	fd = open(name, flags, mode);
 	if (fd < 0)

_
