]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify smbd_do_qfilepathinfo()
authorVolker Lendecke <vl@samba.org>
Thu, 2 Nov 2023 08:13:51 +0000 (09:13 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 19 Nov 2024 18:11:28 +0000 (18:11 +0000)
fdos_mode(fsp) unconditionally dereferences fsp, so we can get rid of
checking for fsp!=NULL.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_trans2.c

index 442515af377e2c975bbf64bb2ddc123eea33286d..4fa72f34978be9463fbb0f3f8378fa1c62963402 100644 (file)
@@ -3021,23 +3021,12 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                 fsp_fnum_dbg(fsp),
                 info_level, max_data_bytes);
 
-       /*
-        * In case of querying a symlink in POSIX context,
-        * fsp will be NULL. fdos_mode() deals with it.
-        */
-       if (fsp != NULL) {
-               smb_fname = fsp->fsp_name;
-       }
+       smb_fname = fsp->fsp_name;
        mode = fdos_mode(fsp);
        psbuf = &smb_fname->st;
 
-       if (fsp != NULL) {
-               base_sp = fsp->base_fsp ?
-                       &fsp->base_fsp->fsp_name->st :
-                       &fsp->fsp_name->st;
-       } else {
-               base_sp = &smb_fname->st;
-       }
+       base_sp = (fsp->base_fsp != NULL) ? &fsp->base_fsp->fsp_name->st
+                                         : &fsp->fsp_name->st;
 
        nlink = psbuf->st_ex_nlink;