8133105: Fix getFinalAttributes() on Windows to handle more special cases
authorsimonis
Tue, 11 Aug 2015 10:53:50 +0200
changeset 32106 f33c38153e63
parent 32105 2b80e6aed222
child 32107 67aa4920495c
8133105: Fix getFinalAttributes() on Windows to handle more special cases Reviewed-by: simonis, rriggs Contributed-by: matthias.baesken@sap.com
jdk/src/java.base/windows/native/libjava/WinNTFileSystem_md.c
--- a/jdk/src/java.base/windows/native/libjava/WinNTFileSystem_md.c	Mon Aug 10 18:58:25 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjava/WinNTFileSystem_md.c	Tue Aug 11 10:53:50 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -233,10 +233,13 @@
 
     if (GetFileAttributesExW(path, GetFileExInfoStandard, &wfad)) {
         attr = getFinalAttributesIfReparsePoint(path, wfad.dwFileAttributes);
-    } else if (GetLastError() == ERROR_SHARING_VIOLATION &&
-               (h = FindFirstFileW(path, &wfd)) != INVALID_HANDLE_VALUE) {
-        attr = getFinalAttributesIfReparsePoint(path, wfd.dwFileAttributes);
-        FindClose(h);
+    } else {
+        DWORD lerr = GetLastError();
+        if ((lerr == ERROR_SHARING_VIOLATION || lerr == ERROR_ACCESS_DENIED) &&
+            (h = FindFirstFileW(path, &wfd)) != INVALID_HANDLE_VALUE) {
+            attr = getFinalAttributesIfReparsePoint(path, wfd.dwFileAttributes);
+            FindClose(h);
+        }
     }
     return attr;
 }