diff options
author | Jeremy Allison <jra@samba.org> | 2009-11-05 21:27:25 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-11-05 21:27:25 -0800 |
commit | 977fa4e37741d613df1583b7e0e83c1f0a6ce38c (patch) | |
tree | a4f62e1c3c3263de3783b3adcc61a6733dc3694c /source3/smbd/close.c | |
parent | e434934526b23b34dd85b43495961260dc639e1f (diff) | |
download | samba-977fa4e37741d613df1583b7e0e83c1f0a6ce38c.tar.gz samba-977fa4e37741d613df1583b7e0e83c1f0a6ce38c.tar.bz2 samba-977fa4e37741d613df1583b7e0e83c1f0a6ce38c.zip |
Revert commit "0551284dc08eb93ef7b2b2227a45e5ec21d482fb" - simplify
the logic. This was incorrect (I'll revisit this tomorrow).
Jeremy.
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r-- | source3/smbd/close.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 3de93b15f2..0f1bd90dde 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -294,7 +294,16 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, DEBUG(10,("close_remove_share_mode: write time forced " "for file %s\n", fsp_str_dbg(fsp))); - set_close_write_time(fsp, lck->changed_write_time); + set_close_write_time(lck, fsp, lck->changed_write_time); + } else if (fsp->update_write_time_on_close) { + DEBUG(10,("close_remove_share_mode: update_write_time_on_close " + "set for file %s\n", + fsp_str_dbg(fsp))); + if (null_timespec(fsp->close_write_time)) { + set_close_write_time(lck, fsp, timespec_current()); + } else { + set_close_write_time(lck, fsp, fsp->close_write_time); + } } if (!del_share_mode(lck, fsp)) { @@ -471,15 +480,30 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, return status; } -void set_close_write_time(struct files_struct *fsp, struct timespec ts) +void set_close_write_time(struct share_mode_lock *lck, + struct files_struct *fsp, struct timespec ts) { DEBUG(6,("close_write_time: %s" , time_to_asc(convert_timespec_to_time_t(ts)))); if (null_timespec(ts)) { return; } + /* + * if the write time on close is explict set, then don't + * need to fix it up to the value in the locking db + */ + fsp->write_time_forced = false; + fsp->update_write_time_on_close = true; fsp->close_write_time = ts; + + /* On close if we're changing the real file time we + * must update it in the open file db too. */ + (void)set_write_time(fsp->file_id, ts); + /* If someone has a sticky write time then update it as well. */ + if (lck && !null_timespec(lck->changed_write_time)) { + (void)set_sticky_write_time(fsp->file_id, ts); + } } static NTSTATUS update_write_time_on_close(struct files_struct *fsp) @@ -508,12 +532,8 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp) return NT_STATUS_OK; } - /* On close if we're changing the real file time we - * must update it in the open file db too. */ - (void)set_write_time(fsp->file_id, fsp->close_write_time); - ft.mtime = fsp->close_write_time; - status = smb_set_file_time(fsp->conn, fsp, fsp->fsp_name, &ft, false); + status = smb_set_file_time(fsp->conn, fsp, fsp->fsp_name, &ft, true); if (!NT_STATUS_IS_OK(status)) { return status; } |