6819689: File.lastModified can return bogus value for remote file accessed as it is being deleted [win]
authoralanb
Tue, 24 Mar 2009 14:08:37 +0000
changeset 2426 a528c0830862
parent 2425 99a19a90813e
child 2427 f35f516befc3
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
jdk/src/windows/native/java/io/WinNTFileSystem_md.c
--- a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c	Tue Mar 24 14:05:44 2009 +0000
+++ b/jdk/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;