1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +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

View File

@ -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;
}