8205416: windows: fix checking of CloseHandle return code in Java_java_io_FileCleanable_cleanupClose0
authormbaesken
Wed, 20 Jun 2018 14:25:45 +0200
changeset 50711 6f63d6886006
parent 50710 d91a64467683
child 50712 df7094f72869
8205416: windows: fix checking of CloseHandle return code in Java_java_io_FileCleanable_cleanupClose0 Reviewed-by: alanb, stuefe
src/java.base/windows/native/libjava/FileDescriptor_md.c
--- a/src/java.base/windows/native/libjava/FileDescriptor_md.c	Fri Jun 22 11:49:31 2018 +0530
+++ b/src/java.base/windows/native/libjava/FileDescriptor_md.c	Wed Jun 20 14:25:45 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -87,7 +87,7 @@
 JNIEXPORT void JNICALL
 Java_java_io_FileCleanable_cleanupClose0(JNIEnv *env, jclass fdClass, jint unused, jlong handle) {
     if (handle != -1) {
-        if (CloseHandle((HANDLE)handle) == -1) {
+        if (!CloseHandle((HANDLE)handle)) {
             JNU_ThrowIOExceptionWithLastError(env, "close failed");
         }
     }