summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-08-08 12:17:04 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-08-17 14:38:06 -0700
commit33c5ddbdac409dcb31fee4f26608b27ed1237949 (patch)
tree24530473176a9b432c3817f3b51356287ab1e807 /xlators
parentb28a47cea459658ae6a2c8a4126614ec04170a16 (diff)
filter: use O_ACCMODE for checking file access modes.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 196 (write-behind window size getting set to 0.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=196
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/filter/src/filter.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c
index 154b172af5c..c9cd8dbfa6b 100644
--- a/xlators/features/filter/src/filter.c
+++ b/xlators/features/filter/src/filter.c
@@ -1059,13 +1059,15 @@ filter_open (call_frame_t *frame,
case GF_FILTER_MAP_UID:
if (loc->inode->st_mode & S_IWGRP)
break;
- if (!((flags & O_WRONLY) || (flags & O_RDWR))
+ if (!(((flags & O_ACCMODE) == O_WRONLY)
+ || ((flags & O_ACCMODE) == O_RDWR))
&& (loc->inode->st_mode & S_IRGRP))
break;
case GF_FILTER_MAP_BOTH:
if (loc->inode->st_mode & S_IWOTH)
break;
- if (!((flags & O_WRONLY) || (flags & O_RDWR))
+ if (!(((flags & O_ACCMODE) == O_WRONLY)
+ || ((flags & O_ACCMODE) == O_RDWR))
&& (loc->inode->st_mode & S_IROTH))
break;
gf_log (this->name, GF_LOG_DEBUG,
@@ -1076,7 +1078,8 @@ filter_open (call_frame_t *frame,
case GF_FILTER_FILTER_UID:
case GF_FILTER_FILTER_GID:
case GF_FILTER_RO_FS:
- if (!((flags & O_WRONLY) || (flags & O_RDWR)))
+ if (!(((flags & O_ACCMODE) == O_WRONLY)
+ || ((flags & O_ACCMODE) == O_RDWR)))
break;
STACK_UNWIND (frame, -1, EROFS, NULL);
return 0;