]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs: Remove some code duplication
authorVolker Lendecke <vl@samba.org>
Thu, 23 Oct 2025 16:53:11 +0000 (18:53 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Nov 2025 13:29:30 +0000 (13:29 +0000)
We do the chdir in both cases

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/modules/vfs_default.c

index 71f21b5d1fc8219d8c423fa0335cbb55f7f6c1e3..3b2463876da8a5766420f10f504eb5214fdd325c 100644 (file)
@@ -210,13 +210,7 @@ static NTSTATUS vfswrap_get_dfs_referrals(struct vfs_handle_struct *handle,
                                   handle->conn->sconn->remote_address,
                                   handle->conn->sconn->local_address,
                                   junction, &consumedcnt, &self_referral);
-       if (!NT_STATUS_IS_OK(status)) {
-               struct smb_filename connectpath_fname = {
-                       .base_name = handle->conn->connectpath
-               };
-               vfs_ChDir(handle->conn, &connectpath_fname);
-               return status;
-       }
+
        {
                struct smb_filename connectpath_fname = {
                        .base_name = handle->conn->connectpath
@@ -224,6 +218,10 @@ static NTSTATUS vfswrap_get_dfs_referrals(struct vfs_handle_struct *handle,
                vfs_ChDir(handle->conn, &connectpath_fname);
        }
 
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
        if (!self_referral) {
                pathnamep[consumedcnt] = '\0';