8280881: (fs) UnixNativeDispatcher.close0 may throw UnixException

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2022-03-10 16:38:44 +00:00
parent 1668c02ee8
commit e8a1ce00b2
10 changed files with 67 additions and 45 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2015, 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
@ -182,7 +182,7 @@ class LinuxDosFileAttributeView
x.rethrowAsIOException(file);
return null; // keep compiler happy
} finally {
close(fd);
close(fd, e -> null);
}
}
@ -277,7 +277,7 @@ class LinuxDosFileAttributeView
} catch (UnixException x) {
x.rethrowAsIOException(file);
} finally {
close(fd);
close(fd, e -> null);
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2019, 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
@ -70,7 +70,7 @@ class LinuxWatchService
socketpair(sp);
configureBlocking(sp[0], false);
} catch (UnixException x) {
UnixNativeDispatcher.close(ifd);
UnixNativeDispatcher.close(ifd, e -> null);
throw new IOException(x.errorString());
}
@ -296,9 +296,9 @@ class LinuxWatchService
// free resources
unsafe.freeMemory(address);
UnixNativeDispatcher.close(socketpair[0]);
UnixNativeDispatcher.close(socketpair[1]);
UnixNativeDispatcher.close(ifd);
UnixNativeDispatcher.close(socketpair[0], e -> null);
UnixNativeDispatcher.close(socketpair[1], e -> null);
UnixNativeDispatcher.close(ifd, e -> null);
}
/**