diff options
author | Jeremy Allison <jra@samba.org> | 2004-11-20 21:24:52 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:24 -0500 |
commit | 9038a56f82e1352c9d7956af08b70a0b8d3cc773 (patch) | |
tree | 5af01a73059fd7d9b7986f040dce225cc2496938 /source3/smbd/fileio.c | |
parent | 9604545ed841bd59b4844d9e96094b4193fd1cd5 (diff) | |
download | samba-9038a56f82e1352c9d7956af08b70a0b8d3cc773.tar.gz samba-9038a56f82e1352c9d7956af08b70a0b8d3cc773.tar.xz samba-9038a56f82e1352c9d7956af08b70a0b8d3cc773.zip |
r3895: Fix for bug #2045. May also fix other timestamp bugs with Excel
(Volker please test). Setting a last write timestamp from Windows
overrides any subsequent write timestamp changes and must be immediately
seen by and findfirst/findnexts. This is a racy solution, but should
work most of the time. This may also fix #1061, not sure.
Jeremy.
(This used to be commit 47bab92c0b062f3fefbb4fd4a09852e1c829a7f9)
Diffstat (limited to 'source3/smbd/fileio.c')
-rw-r--r-- | source3/smbd/fileio.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index b9fe1ad1cfc..dde254644ff 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -130,6 +130,20 @@ static ssize_t real_write_file(files_struct *fsp,char *data,SMB_OFF_T pos, size_ if (ret != -1) { fsp->pos += ret; + /* + * It turns out that setting the last write time from a Windows + * client stops any subsequent writes from updating the write time. + * Doing this after the write gives a race condition here where + * a stat may see the changed write time before we reset it here, + * but it's cheaper than having to store the write time in shared + * memory and look it up using dev/inode across all running smbd's. + * The 99% solution will hopefully be good enough in this case. JRA. + */ + + if (fsp->pending_modtime) { + set_filetime(fsp->conn, fsp->fsp_name, fsp->pending_modtime); + } + /* Yes - this is correct - writes don't update this. JRA. */ /* Found by Samba4 tests. */ #if 0 |