changeset 1070:78063cf930e5

6819689: File.lastModified can return bogus value for remote file accessed as it is being deleted [win] Reviewed-by: sherman Contributed-by: andreas.frischknecht@softwired-inc.com
author alanb
date Tue, 24 Mar 2009 14:08:37 +0000
parents 4c3f752993a5
children 52bdf8cec41d
files src/windows/native/java/io/WinNTFileSystem_md.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/java/io/WinNTFileSystem_md.c	Tue Mar 24 14:05:44 2009 +0000
+++ b/src/windows/native/java/io/WinNTFileSystem_md.c	Tue Mar 24 14:08:37 2009 +0000
@@ -309,12 +309,13 @@
                     /* No template file */
                     NULL);
     if (h != INVALID_HANDLE_VALUE) {
-        GetFileTime(h, NULL, NULL, &t);
+        if (GetFileTime(h, NULL, NULL, &t)) {
+            modTime.LowPart = (DWORD) t.dwLowDateTime;
+            modTime.HighPart = (LONG) t.dwHighDateTime;
+            rv = modTime.QuadPart / 10000;
+            rv -= 11644473600000;
+        }
         CloseHandle(h);
-        modTime.LowPart = (DWORD) t.dwLowDateTime;
-        modTime.HighPart = (LONG) t.dwHighDateTime;
-        rv = modTime.QuadPart / 10000;
-        rv -= 11644473600000;
     }
     free(pathbuf);
     return rv;