pvfs_close: correctly handle the write time updates passed by close()
authorStefan Metzmacher <metze@samba.org>
Thu, 8 May 2008 20:16:55 +0000 (22:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 3 Jun 2008 12:03:52 +0000 (14:03 +0200)
metze

source/ntvfs/posix/pvfs_open.c
source/ntvfs/posix/pvfs_resolve.c

index c7f93fb0d85955938ebb1236ba5b56334d1c326e..a78d0a79c7dbd878d9c31317c5a237b1af607649 100644 (file)
@@ -1591,7 +1591,6 @@ NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs,
 {
        struct pvfs_state *pvfs = ntvfs->private_data;
        struct pvfs_file *f;
-       struct utimbuf unix_times;
 
        if (io->generic.level == RAW_CLOSE_SPLCLOSE) {
                return NT_STATUS_DOS(ERRSRV, ERRerror);
@@ -1607,9 +1606,9 @@ NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs,
        }
 
        if (!null_time(io->generic.in.write_time)) {
-               unix_times.actime = 0;
-               unix_times.modtime = io->close.in.write_time;
-               utime(f->handle->name->full_name, &unix_times);
+               f->handle->write_time.update_forced = false;
+               f->handle->write_time.update_on_close = true;
+               unix_to_nt_time(&f->handle->write_time.close_time, io->generic.in.write_time);
        }
 
        if (io->generic.in.flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) {
index 969a50239fab12d3e2844467d69b3674676be99e..0f19788b9731d0587f5d3e6b50bb7f7aefd326c1 100644 (file)
@@ -712,6 +712,10 @@ NTSTATUS pvfs_resolve_name_handle(struct pvfs_state *pvfs,
        status = pvfs_resolve_name_fd(pvfs, h->fd, h->name, 0);
        NT_STATUS_NOT_OK_RETURN(status);
 
+       if (!null_nttime(h->write_time.close_time)) {
+               h->name->dos.write_time = h->write_time.close_time;
+       }
+
        return NT_STATUS_OK;
 }