]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify copy_stat_ex_timestamps
authorVolker Lendecke <vl@samba.org>
Tue, 25 Jun 2024 10:39:09 +0000 (12:39 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 28 Jun 2024 13:26:24 +0000 (13:26 +0000)
copy_stat_ex_timestamps doesn't need the fsp, it only needs the
destination stat struct

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/include/proto.h
source3/lib/system.c
source3/smbd/dosmode.c

index 9ccbbaee48a2f220f63c5399c3b81f4879e33040..bd7efce1f39f458f4a11dbe6e6d3fa12d28537ec 100644 (file)
@@ -173,7 +173,8 @@ void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
 void update_stat_ex_create_time(struct stat_ex *dst, struct timespec create_time);
 void update_stat_ex_from_saved_stat(struct stat_ex *dst,
                                    const struct stat_ex *src);
-void copy_stat_ex_timestamps(files_struct *fsp, const struct smb_file_time *ft);
+void copy_stat_ex_timestamps(struct stat_ex *st,
+                            const struct smb_file_time *ft);
 int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
             bool fake_dir_create_times);
 int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
index 2006edbed6575b38652825048e30c1436bf0154c..e882e173f117ae3d63836ad7f1bf83016d0a5fcb 100644 (file)
@@ -249,22 +249,23 @@ void update_stat_ex_from_saved_stat(struct stat_ex *dst,
        }
 }
 
-void copy_stat_ex_timestamps(files_struct *fsp, const struct smb_file_time *ft)
+void copy_stat_ex_timestamps(struct stat_ex *st,
+                            const struct smb_file_time *ft)
 {
        if (!is_omit_timespec(&ft->atime)) {
-               fsp->fsp_name->st.st_ex_atime = ft->atime;
+               st->st_ex_atime = ft->atime;
        }
 
        if (!is_omit_timespec(&ft->create_time)) {
-               fsp->fsp_name->st.st_ex_btime = ft->create_time;
+               st->st_ex_btime = ft->create_time;
        }
 
        if (!is_omit_timespec(&ft->ctime)) {
-               fsp->fsp_name->st.st_ex_ctime = ft->ctime;
+               st->st_ex_ctime = ft->ctime;
        }
 
        if (!is_omit_timespec(&ft->mtime)) {
-               fsp->fsp_name->st.st_ex_mtime = ft->mtime;
+               st->st_ex_mtime = ft->mtime;
        }
 }
 
index 13aadb58a92ed3f03770560f54896ce9a1825e22..e0a6f1672b0644c952394849792a11cbf0d8a38b 100644 (file)
@@ -1226,7 +1226,7 @@ int file_ntimes(connection_struct *conn,
 
 done:
        if (ret == 0) {
-               copy_stat_ex_timestamps(fsp, ft);
+               copy_stat_ex_timestamps(&fsp->fsp_name->st, ft);
        }
 
        return ret;