summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-12-17 18:10:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:33 -0500
commit771f5956937a1697b05ea29a00b9fdd36022188f (patch)
tree6446854832f53cde4dade65a45cf9eeddcbcd23a /source3/smbd
parentf5b3bed84f204c8cf42126375724ebeb8d7f0cd2 (diff)
downloadsamba-771f5956937a1697b05ea29a00b9fdd36022188f.tar.gz
samba-771f5956937a1697b05ea29a00b9fdd36022188f.tar.bz2
samba-771f5956937a1697b05ea29a00b9fdd36022188f.zip
r20227: Simplify logic in vfs_MkDir() a bit
(This used to be commit b24cf79e9ec914ac33f1a20524e5ffa7fe1cba5e)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/vfs.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 3ed56d3bf6..ab9ddef9ff 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -315,20 +315,24 @@ int vfs_MkDir(connection_struct *conn, const char *name, mode_t mode)
int ret;
SMB_STRUCT_STAT sbuf;
- if(!(ret=SMB_VFS_MKDIR(conn, name, mode))) {
+ if ((ret=SMB_VFS_MKDIR(conn, name, mode)) != 0) {
+ return ret;
+ }
- inherit_access_acl(conn, name, mode);
+ inherit_access_acl(conn, name, mode);
- /*
- * Check if high bits should have been set,
- * then (if bits are missing): add them.
- * Consider bits automagically set by UNIX, i.e. SGID bit from parent dir.
- */
- if(mode & ~(S_IRWXU|S_IRWXG|S_IRWXO) &&
- !SMB_VFS_STAT(conn,name,&sbuf) && (mode & ~sbuf.st_mode))
- SMB_VFS_CHMOD(conn,name,sbuf.st_mode | (mode & ~sbuf.st_mode));
+ /*
+ * Check if high bits should have been set,
+ * then (if bits are missing): add them.
+ * Consider bits automagically set by UNIX, i.e. SGID bit from parent
+ * dir.
+ */
+ if (mode & ~(S_IRWXU|S_IRWXG|S_IRWXO)
+ && (SMB_VFS_STAT(conn,name,&sbuf) == 0)
+ && (mode & ~sbuf.st_mode)) {
+ SMB_VFS_CHMOD(conn,name,sbuf.st_mode | (mode & ~sbuf.st_mode));
}
- return ret;
+ return 0;
}
/*******************************************************************