aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r--fs/cifs/dir.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index cf90c9ad2c87..8dfe717a332a 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -146,24 +146,23 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
146 return -ENOMEM; 146 return -ENOMEM;
147 } 147 }
148 148
149 if(nd) { 149 if(nd && (nd->flags & LOOKUP_OPEN)) {
150 if ((nd->intent.open.flags & O_ACCMODE) == O_RDONLY) 150 int oflags = nd->intent.open.flags;
151 desiredAccess = GENERIC_READ; 151
152 else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY) { 152 desiredAccess = 0;
153 desiredAccess = GENERIC_WRITE; 153 if (oflags & FMODE_READ)
154 write_only = TRUE; 154 desiredAccess |= GENERIC_READ;
155 } else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) { 155 if (oflags & FMODE_WRITE) {
156 /* GENERIC_ALL is too much permission to request */ 156 desiredAccess |= GENERIC_WRITE;
157 /* can cause unnecessary access denied on create */ 157 if (!(oflags & FMODE_READ))
158 /* desiredAccess = GENERIC_ALL; */ 158 write_only = TRUE;
159 desiredAccess = GENERIC_READ | GENERIC_WRITE;
160 } 159 }
161 160
162 if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) 161 if((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
163 disposition = FILE_CREATE; 162 disposition = FILE_CREATE;
164 else if((nd->intent.open.flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) 163 else if((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
165 disposition = FILE_OVERWRITE_IF; 164 disposition = FILE_OVERWRITE_IF;
166 else if((nd->intent.open.flags & O_CREAT) == O_CREAT) 165 else if((oflags & O_CREAT) == O_CREAT)
167 disposition = FILE_OPEN_IF; 166 disposition = FILE_OPEN_IF;
168 else { 167 else {
169 cFYI(1,("Create flag not set in create function")); 168 cFYI(1,("Create flag not set in create function"));