8262957: (fs) Fail fast in UnixFileStore.isExtendedAttributesEnabled

Reviewed-by: alanb
This commit is contained in:
Sebastian Stenzel 2021-04-14 09:55:52 +00:00 committed by Alan Bateman
parent e2106d5af6
commit 27dd88bf9e
3 changed files with 21 additions and 2 deletions

View file

@ -179,6 +179,11 @@ abstract class UnixFileStore
* @return <code>true</code> if enabled, <code>false</code> if disabled or unable to determine
*/
protected boolean isExtendedAttributesEnabled(UnixPath path) {
if (!UnixNativeDispatcher.xattrSupported()) {
// avoid I/O if native code doesn't support xattr
return false;
}
int fd = -1;
try {
fd = path.openForAttributeAccess(false);