RFR [XS] : 8205416 : windows: fix checking of CloseHandle return code in Java_java_io_FileCleanable_cleanupClose0
Thomas Stüfe
thomas.stuefe at gmail.com
Wed Jun 20 12:16:40 UTC 2018
Good catch.
Could you please change the expression to either
CloseHandle() == FALSE (uppercase)
or
!CloseHandle().
? which would be the standard windows way of writing this.
I am curious whether we now get a bunch of follow up errors, since
before we never catched a failing CloseHandle. A typical reason why
this could fail would be a double close.
..Thomas
On Wed, Jun 20, 2018 at 2:09 PM, Baesken, Matthias
<matthias.baesken at sap.com> wrote:
> Please review this small fix for a return code handling of windows function CloseHandle .
>
> MSDN documents CloseHandle here : https://msdn.microsoft.com/de-de/library/windows/desktop/ms724211(v=vs.85).aspx
> ....
> Return value
> If the function succeeds, the return value is nonzero.
> If the function fails, the return value is zero. To get extended error information, call GetLastError<https://msdn.microsoft.com/de-de/library/windows/desktop/ms679360(v=vs.85).aspx>.
>
>
> However until this patch, Java_java_io_FileCleanable_cleanupClose0
> Checked for return code -1 of CloseHandle in error cases .
>
>
>
>
> Bug:
>
> https://bugs.openjdk.java.net/browse/JDK-8205416
>
>
> Webrev :
>
> http://cr.openjdk.java.net/~mbaesken/webrevs/8205416/
>
>
>
> Thanks, Matthias
More information about the core-libs-dev
mailing list