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);
int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
bool fake_dir_create_times);
int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
}
}
+void copy_stat_ex_timestamps(files_struct *fsp, const struct smb_file_time *ft)
+{
+ if (!is_omit_timespec(&ft->atime)) {
+ fsp->fsp_name->st.st_ex_atime = ft->atime;
+ }
+
+ if (!is_omit_timespec(&ft->create_time)) {
+ fsp->fsp_name->st.st_ex_btime = ft->create_time;
+ }
+
+ if (!is_omit_timespec(&ft->ctime)) {
+ fsp->fsp_name->st.st_ex_ctime = ft->ctime;
+ }
+
+ if (!is_omit_timespec(&ft->mtime)) {
+ fsp->fsp_name->st.st_ex_mtime = ft->mtime;
+ }
+}
+
void init_stat_ex_from_stat (struct stat_ex *dst,
const struct stat *src,
bool fake_dir_create_times)
}
if (SMB_VFS_FNTIMES(fsp, ft) == 0) {
- return 0;
+ ret = 0;
+ goto done;
}
if((errno != EPERM) && (errno != EACCES)) {
unbecome_root();
}
+done:
+ if (ret == 0) {
+ copy_stat_ex_timestamps(fsp, ft);
+ }
+
return ret;
}