From: Shachar Sharon Date: Thu, 30 May 2024 07:27:35 +0000 (+0300) Subject: vfs_ceph: improve readability of cephwrap_realpath X-Git-Tag: tdb-1.4.11~291 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e21a8b278629ac043ae20ca8a445e2d1138af82;p=thirdparty%2Fsamba.git 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 Reviewed-by: Andrew Bartlett Reviewed-by: David Disseldorp Reviewed-by: Ralph Boehme Reviewed-by: Guenther Deschner Reviewed-by: Anoop C S --- diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index bb1650446c9..e8cb2547d89 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -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) {