mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8280881: (fs) UnixNativeDispatcher.close0 may throw UnixException
Reviewed-by: alanb
This commit is contained in:
parent
1668c02ee8
commit
e8a1ce00b2
10 changed files with 67 additions and 45 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2022, 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
|
||||
|
@ -431,13 +431,14 @@ public abstract class UnixFileSystemProvider
|
|||
dfd2 = dup(dfd1);
|
||||
dp = fdopendir(dfd1);
|
||||
} catch (UnixException x) {
|
||||
IOException ioe = x.errno() == UnixConstants.ENOTDIR ?
|
||||
new NotDirectoryException(dir.getPathForExceptionMessage()) :
|
||||
x.asIOException(dir);
|
||||
if (dfd1 != -1)
|
||||
UnixNativeDispatcher.close(dfd1);
|
||||
UnixNativeDispatcher.close(dfd1, e -> null);
|
||||
if (dfd2 != -1)
|
||||
UnixNativeDispatcher.close(dfd2);
|
||||
if (x.errno() == UnixConstants.ENOTDIR)
|
||||
throw new NotDirectoryException(dir.getPathForExceptionMessage());
|
||||
x.rethrowAsIOException(dir);
|
||||
UnixNativeDispatcher.close(dfd2, e -> null);
|
||||
throw ioe;
|
||||
}
|
||||
return new UnixSecureDirectoryStream(dir, dp, dfd2, filter);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue