changeset 51288:be1020446dd5

8205959: Do not restart close if errno is EINTR Reviewed-by: alanb, vtewari
author igerasim
date Thu, 28 Jun 2018 01:10:09 -0700
parents addda6247cb0
children 830b05ca7f58
files src/java.base/linux/native/libnet/linux_close.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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