From 33c5ddbdac409dcb31fee4f26608b27ed1237949 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Sat, 8 Aug 2009 12:17:04 +0000 Subject: filter: use O_ACCMODE for checking file access modes. Signed-off-by: Anand V. Avati BUG: 196 (write-behind window size getting set to 0.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=196 --- xlators/features/filter/src/filter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xlators') diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c index 154b172af..c9cd8dbfa 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; -- cgit