diff options
author | Volker Lendecke <vl@samba.org> | 2013-04-09 21:07:23 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-04-09 22:20:35 +0200 |
commit | 60c2953a9d5fa12494a8a767c30913398affe453 (patch) | |
tree | df1c49337433da0b490b8e3cbb1c4135731a9ea9 | |
parent | a308db6587c866826a280a60b841f0a3926c1078 (diff) | |
download | samba-60c2953a9d5fa12494a8a767c30913398affe453.tar.gz samba-60c2953a9d5fa12494a8a767c30913398affe453.tar.bz2 samba-60c2953a9d5fa12494a8a767c30913398affe453.zip |
vfs_fake_perms: Slightly streamline code
Do an early error return
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/modules/vfs_fake_perms.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c index 4cda7ea160..a447f311c3 100644 --- a/source3/modules/vfs_fake_perms.c +++ b/source3/modules/vfs_fake_perms.c @@ -35,16 +35,18 @@ static int fake_perms_stat(vfs_handle_struct *handle, int ret = -1; ret = SMB_VFS_NEXT_STAT(handle, smb_fname); - if (ret == 0) { - if (S_ISDIR(smb_fname->st.st_ex_mode)) { - smb_fname->st.st_ex_mode = S_IFDIR | S_IRWXU; - } else { - smb_fname->st.st_ex_mode = S_IRWXU; - } - smb_fname->st.st_ex_uid = handle->conn->session_info->unix_token->uid; - smb_fname->st.st_ex_gid = handle->conn->session_info->unix_token->gid; + if (ret != 0) { + return ret; } + if (S_ISDIR(smb_fname->st.st_ex_mode)) { + smb_fname->st.st_ex_mode = S_IFDIR | S_IRWXU; + } else { + smb_fname->st.st_ex_mode = S_IRWXU; + } + smb_fname->st.st_ex_uid = handle->conn->session_info->unix_token->uid; + smb_fname->st.st_ex_gid = handle->conn->session_info->unix_token->gid; + return ret; } @@ -53,15 +55,18 @@ static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_ST int ret = -1; ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); - if (ret == 0) { - if (S_ISDIR(sbuf->st_ex_mode)) { - sbuf->st_ex_mode = S_IFDIR | S_IRWXU; - } else { - sbuf->st_ex_mode = S_IRWXU; - } - sbuf->st_ex_uid = handle->conn->session_info->unix_token->uid; - sbuf->st_ex_gid = handle->conn->session_info->unix_token->gid; + if (ret != 0) { + return ret; } + + if (S_ISDIR(sbuf->st_ex_mode)) { + sbuf->st_ex_mode = S_IFDIR | S_IRWXU; + } else { + sbuf->st_ex_mode = S_IRWXU; + } + sbuf->st_ex_uid = handle->conn->session_info->unix_token->uid; + sbuf->st_ex_gid = handle->conn->session_info->unix_token->gid; + return ret; } |