1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

vfs_ceph: improve readability of cephwrap_realpath

Minor code cleanup: use local variable to reference current-work dir.
This commit is in preparation to following code-cleanup which aligns
line-length with Samba's coding conventions.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
This commit is contained in:
Shachar Sharon 2024-05-30 10:27:35 +03:00 committed by Anoop C S
parent 3c1691aff5
commit 4e21a8b278

View File

@ -1503,6 +1503,7 @@ static struct smb_filename *cephwrap_realpath(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
char *result = NULL;
const char *cwd = handle->conn->cwd_fsp->fsp_name->base_name;
const char *path = smb_fname->base_name;
size_t len = strlen(path);
struct smb_filename *result_fname = NULL;
@ -1512,15 +1513,12 @@ static struct smb_filename *cephwrap_realpath(struct vfs_handle_struct *handle,
r = asprintf(&result, "%s", path);
} else if ((len >= 2) && (path[0] == '.') && (path[1] == '/')) {
if (len == 2) {
r = asprintf(&result, "%s",
handle->conn->cwd_fsp->fsp_name->base_name);
r = asprintf(&result, "%s", cwd);
} else {
r = asprintf(&result, "%s/%s",
handle->conn->cwd_fsp->fsp_name->base_name, &path[2]);
r = asprintf(&result, "%s/%s", cwd, &path[2]);
}
} else {
r = asprintf(&result, "%s/%s",
handle->conn->cwd_fsp->fsp_name->base_name, path);
r = asprintf(&result, "%s/%s", cwd, path);
}
if (r < 0) {