[libgsystem] fileutils: Don't loop for EINTR on close()



commit 980fb78af5953423042bf9b426caeb72ac2b73a5
Author: Colin Walters <walters verbum org>
Date:   Fri Jan 25 15:18:51 2013 -0500

    fileutils: Don't loop for EINTR on close()
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=682819

 gsystem-file-utils.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gsystem-file-utils.c b/gsystem-file-utils.c
index 140d53a..07d35c1 100644
--- a/gsystem-file-utils.c
+++ b/gsystem-file-utils.c
@@ -36,9 +36,13 @@ static int
 close_nointr (int fd)
 {
   int res;
-  do
-    res = close (fd);
-  while (G_UNLIKELY (res != 0 && errno == EINTR));
+  /* Note this is NOT actually a retry loop.
+   * See: https://bugzilla.gnome.org/show_bug.cgi?id=682819
+   */
+  res = close (fd);
+  /* Just ignore EINTR...on Linux, retrying is wrong. */
+  if (res == EINTR)
+    res = 0;
   return res;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]