summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@zresearch.com>2009-07-07 02:33:43 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-07 16:24:52 -0700
commit54f5ccceca2531f1a88cb4d0404f92edffa09cae (patch)
tree7ec8111f5193ffecb7300cedc955f4e137f0a0eb /xlators
parent4e9757859750eb3625828f83681845f1352af356 (diff)
filter: use O_ACCMODE for checking file access modes.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
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;