]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_gpfs: Fix CID 1666430 Control flow issues (DEADCODE)
authorAnoop C S <anoopcs@samba.org>
Fri, 3 Oct 2025 05:57:29 +0000 (11:27 +0530)
committerGünther Deschner <gd@samba.org>
Wed, 26 Nov 2025 16:48:00 +0000 (16:48 +0000)
Restore the saved errno properly and record it with vfs_aio_state once
vfs_gpfs_get_winattrs_helper() returns for async code path.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Nov 26 16:48:00 UTC 2025 on atb-devel-224

source3/modules/vfs_gpfs.c

index 9c88641577ea16f5bcc98529b7261aa9595cfc78..3317d520e239fe6931f7477f64ce00eadb5b9480 100644 (file)
@@ -1448,11 +1448,6 @@ static int vfs_gpfs_get_winattrs_helper(
 
        ret = gpfswrap_get_winattrs(fsp_get_pathref_fd(fd), &state->attrs);
 
-       if (ret == -1) {
-               state->job_state.vfs_aio_state.error = errno;
-               return ret;
-       }
-
        if (ret == -1 && errno == EACCES) {
                int saved_errno = 0;
 
@@ -1468,16 +1463,12 @@ static int vfs_gpfs_get_winattrs_helper(
                ret = gpfswrap_get_winattrs(
                        fsp_get_pathref_fd(fd),
                        &state->attrs);
-               if (ret == -1) {
-                       saved_errno = errno;
-               }
+
+               saved_errno = errno;
 
                drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
 
-               if (saved_errno != 0) {
-                       state->job_state.vfs_aio_state.error = saved_errno;
-                       ret = saved_errno;
-               }
+               errno = saved_errno;
        }
        return ret;
 }
@@ -1633,6 +1624,7 @@ static void vfs_gpfs_get_winattrs_do_async(void *private_data)
        ret = vfs_gpfs_get_winattrs_helper(state);
 
        if (ret == -1) {
+               state->job_state.vfs_aio_state.error = errno;
                DBG_WARNING("Getting winattrs failed for %s: %s\n",
                                state->job_state.dir_fsp->fsp_name->base_name,
                                strerror(errno));