From e5a304193ba1bba20c8f40c1e5bb6f0adab52d0c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Jun 2024 12:39:09 +0200 Subject: [PATCH] smbd: Simplify copy_stat_ex_timestamps copy_stat_ex_timestamps doesn't need the fsp, it only needs the destination stat struct Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- source3/include/proto.h | 3 ++- source3/lib/system.c | 11 ++++++----- source3/smbd/dosmode.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 9ccbbaee48a..bd7efce1f39 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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, diff --git a/source3/lib/system.c b/source3/lib/system.c index 2006edbed65..e882e173f11 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -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; } } diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 13aadb58a92..e0a6f1672b0 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -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; -- 2.47.3