]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph: improve readability of cephwrap_realpath
authorShachar Sharon <ssharon@redhat.com>
Thu, 30 May 2024 07:27:35 +0000 (10:27 +0300)
committerAnoop C S <anoopcs@samba.org>
Thu, 27 Jun 2024 05:34:33 +0000 (05:34 +0000)
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>
source3/modules/vfs_ceph.c

index bb1650446c9669879033ab3cba6dd5b2d1ca7e6a..e8cb2547d89c5404e543a3ff3933c21f6983deac 100644 (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) {