[glib: 4/5] gspawn: Retry on EBUSY errors from dup2()



commit 1097b50c1c46c43b6b6af9aeefed447c6eb23b06
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Sep 26 14:13:01 2019 +0100

    gspawn: Retry on EBUSY errors from dup2()
    
    `man dup2` says that on Linux, dup2() can return `EBUSY` if the
    operation needs to be retried (in addition to returning `EINTR` in other
    cases where it needs to be retried).
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/gspawn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gspawn.c b/glib/gspawn.c
index 2c154da5d..bcbaec78f 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -1297,7 +1297,7 @@ sane_dup2 (gint fd1, gint fd2)
 
   do
     ret = dup2 (fd1, fd2);
-  while (ret < 0 && errno == EINTR);
+  while (ret < 0 && (errno == EINTR || errno == EBUSY));
 
   return ret;
 }


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