[vhffs-dev] [1625] O_RDONLY value is 0, so O_RDONLY is the default, then we need to test O_WRONLY and O_RDWR instead of O_RDONLY and O_WRONLY, and set O_RDONLY as default action

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1625
Author:   gradator
Date:     2010-09-07 01:37:13 +0200 (Tue, 07 Sep 2010)
Log Message:
-----------
O_RDONLY value is 0, so O_RDONLY is the default, then we need to test O_WRONLY and O_RDWR instead of O_RDONLY and O_WRONLY, and set O_RDONLY as default action

Modified Paths:
--------------
    trunk/vhffs-fs/vhffsfs.c

Modified: trunk/vhffs-fs/vhffsfs.c
===================================================================
--- trunk/vhffs-fs/vhffsfs.c	2010-09-06 23:16:04 UTC (rev 1624)
+++ trunk/vhffs-fs/vhffsfs.c	2010-09-06 23:37:13 UTC (rev 1625)
@@ -1799,12 +1799,14 @@
 {
 	int fd;
 	char *rpath;
-	int mode = R_OK|W_OK;
+	int mode = R_OK;
 
-	if(fi->flags & O_WRONLY)
+	if(fi->flags & O_WRONLY) {
 		mode = W_OK;
-	else if(fi->flags & O_RDONLY)
-		mode = R_OK;
+	}
+	else if(fi->flags & O_RDWR) {
+		mode = R_OK|W_OK;
+	}
 
 	rpath = vhffsfs_realpath(path, NULL, NULL, mode);
 	if(!rpath) return -errno;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/