src/java.base/linux/native/libnet/linux_close.c
changeset 50869 be1020446dd5
parent 47216 71c04702a3d5
child 53741 38b6110d5db2
--- a/src/java.base/linux/native/libnet/linux_close.c	Thu Jun 28 10:05:43 2018 +0200
+++ b/src/java.base/linux/native/libnet/linux_close.c	Thu Jun 28 01:10:09 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -290,13 +290,13 @@
          * And close/dup the file descriptor
          * (restart if interrupted by signal)
          */
-        do {
-            if (fd1 < 0) {
-                rv = close(fd2);
-            } else {
+        if (fd1 < 0) {
+            rv = close(fd2);
+        } else {
+            do {
                 rv = dup2(fd1, fd2);
-            }
-        } while (rv == -1 && errno == EINTR);
+            } while (rv == -1 && errno == EINTR);
+        }
 
         /*
          * Send a wakeup signal to all threads blocked on this