]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Fix CID 1665417, UNUSED_VALUE in openat_pathref_fsp_dot()
authorAnoop C S <anoopcs@samba.org>
Thu, 11 Sep 2025 06:11:25 +0000 (11:41 +0530)
committerAnoop C S <anoopcs@samba.org>
Mon, 15 Sep 2025 15:44:38 +0000 (15:44 +0000)
Rearrange how the open flags are defined so as to make Coverity happy
about it.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15897

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Sep 15 15:44:38 UTC 2025 on atb-devel-224

source3/smbd/files.c

index 3cf1e78a7040febfe48d0442c67e5932af9d4572..334810e45f91279a600944cccfbb026d6933e8d1 100644 (file)
@@ -1672,9 +1672,7 @@ NTSTATUS openat_pathref_fsp_dot(TALLOC_CTX *mem_ctx,
        struct connection_struct *conn = dirfsp->conn;
        struct files_struct *fsp = NULL;
        struct smb_filename *full_fname = NULL;
-        struct vfs_open_how how = {
-                .flags = O_RDONLY | O_NONBLOCK | O_NOFOLLOW,
-        };
+       struct vfs_open_how how = { .flags = O_NOFOLLOW, };
         struct smb_filename *dot = NULL;
         NTSTATUS status;
         int fd;
@@ -1684,7 +1682,9 @@ NTSTATUS openat_pathref_fsp_dot(TALLOC_CTX *mem_ctx,
 #endif
 
 #ifdef O_PATH
-        how.flags = O_PATH;
+       how.flags |= O_PATH;
+#else
+       how.flags |= (O_RDONLY | O_NONBLOCK);
 #endif
 
        dot = synthetic_smb_fname(mem_ctx, ".", NULL, NULL, 0, flags);