1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

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>
This commit is contained in:
Volker Lendecke 2013-04-09 21:07:23 +02:00 committed by Jeremy Allison
parent a308db6587
commit 60c2953a9d

@ -35,7 +35,10 @@ static int fake_perms_stat(vfs_handle_struct *handle,
int ret = -1;
ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
if (ret == 0) {
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 {
@ -43,7 +46,6 @@ static int fake_perms_stat(vfs_handle_struct *handle,
}
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,7 +55,10 @@ 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 (ret != 0) {
return ret;
}
if (S_ISDIR(sbuf->st_ex_mode)) {
sbuf->st_ex_mode = S_IFDIR | S_IRWXU;
} else {
@ -61,7 +66,7 @@ static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_ST
}
sbuf->st_ex_uid = handle->conn->session_info->unix_token->uid;
sbuf->st_ex_gid = handle->conn->session_info->unix_token->gid;
}
return ret;
}