]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: default. Fix vfswrap_readdir() to use sys_fstatat().
authorJeremy Allison <jra@samba.org>
Tue, 13 Jul 2021 16:10:50 +0000 (09:10 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 14 Jul 2021 08:09:31 +0000 (08:09 +0000)
Change struct stat st -> SMB_STRUCT_STAT st
and just copy the struct on success, as sys_fstatat()
already does the init_stat_ex_from_stat() for us.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_default.c

index 67253702432368dcd564bb4be7ae167e79e11cc7..059a38a1320f772af16e8c510b42f2d7f7c14b24 100644 (file)
@@ -583,7 +583,7 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
        struct dirent *result;
        bool fake_ctime = lp_fake_directory_create_times(SNUM(handle->conn));
        int flags = AT_SYMLINK_NOFOLLOW;
-       struct stat st;
+       SMB_STRUCT_STAT st;
        int ret;
 
        START_PROFILE(syscall_readdir);
@@ -604,10 +604,11 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
         */
        SET_STAT_INVALID(*sbuf);
 
-       ret = fstatat(dirfd(dirp),
+       ret = sys_fstatat(dirfd(dirp),
                      result->d_name,
                      &st,
-                     flags);
+                     flags,
+                     fake_ctime);
        if (ret != 0) {
                return result;
        }
@@ -618,12 +619,12 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
         * as we don't know if they wanted the link info, or its
         * target info.
         */
-       if (S_ISLNK(st.st_mode) &&
+       if (S_ISLNK(st.st_ex_mode) &&
            !(dirfsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH))
        {
                return result;
        }
-       init_stat_ex_from_stat(sbuf, &st, fake_ctime);
+       *sbuf = st;
 
        return result;
 }