summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-12-16 21:04:19 +0000
committerJeremy Allison <jra@samba.org>2001-12-16 21:04:19 +0000
commit0fd94a5c4b659e715e16fa4b2d5102520412ad55 (patch)
tree49c6435e62fa301fa34c5b8cb558cf84697ebe3f /source3/smbd/close.c
parent9c1120faeb116ef0bdbf03a9f2bd30fadced0007 (diff)
downloadsamba-0fd94a5c4b659e715e16fa4b2d5102520412ad55.tar.gz
samba-0fd94a5c4b659e715e16fa4b2d5102520412ad55.tar.bz2
samba-0fd94a5c4b659e715e16fa4b2d5102520412ad55.zip
Ensured filetimes set (by name) after close. Ignore errors. This is the
correct way to ensure times set in 'pending modtime' and 'time close' are always set correctly. Inspired by patch from Juergen Hasch. Jeremy. (This used to be commit 24053858543fa6c22c0c3222570109fbfdabab9e)
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r--source3/smbd/close.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index fae43fca5d..879c91a81a 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -119,6 +119,7 @@ static int close_normal_file(files_struct *fsp, BOOL normal_close)
size_t share_entry_count = 0;
BOOL delete_on_close = False;
connection_struct *conn = fsp->conn;
+ time_t pending_modtime = fsp->pending_modtime;
int err = 0;
int err1 = 0;
@@ -196,14 +197,22 @@ with error %s\n", fsp->fsp_name, strerror(errno) ));
check_magic(fsp,conn);
}
+ /*
+ * Ensure pending modtime is set after close.
+ */
+
+ if(fsp->pending_modtime) {
+ int saved_errno = errno;
+ set_filetime(conn, fsp->fsp_name, fsp->pending_modtime);
+ errno = saved_errno;
+ }
DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
conn->user,fsp->fsp_name,
conn->num_files_open, err ? strerror(err) : ""));
- if (fsp->fsp_name) {
+ if (fsp->fsp_name)
string_free(&fsp->fsp_name);
- }
file_free(fsp);