[exim-cvs] Handle EINTR from transport-pipe write

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Exim Git Commits Mailing List
Ημερομηνία:  
Προς: exim-cvs
Αντικείμενο: [exim-cvs] Handle EINTR from transport-pipe write
Gitweb: https://git.exim.org/exim.git/commitdiff/a76f64c3d496f6e448db3fb0c88fb15c2d1d99db
Commit:     a76f64c3d496f6e448db3fb0c88fb15c2d1d99db
Parent:     aa81ee147537e2b6c2affb90749fb35cfc996396
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Dec 17 16:55:25 2019 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Dec 17 16:55:25 2019 +0000


    Handle EINTR from transport-pipe write
---
 src/src/deliver.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)


diff --git a/src/src/deliver.c b/src/src/deliver.c
index 28a1174..733fe6f 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -4147,10 +4147,14 @@ if (PIPE_HEADER_SIZE != snprintf(CS pipe_header, PIPE_HEADER_SIZE+1, "%c%c%05ld"
 DEBUG(D_deliver) debug_printf("header write id:%c,subid:%c,size:%ld,final:%s\n",
                                  id, subid, (long)size, pipe_header);


-if ((ret = writev(fd, iov, 2)) != total_len)
-  log_write(0, LOG_MAIN|LOG_PANIC_DIE,
-    "Failed writing transport result to pipe (%ld of %ld bytes): %s",
-    (long)ret, (long)total_len, ret == -1 ? strerror(errno) : "short write");
+for (int retries = 10; retries > 0; retries--)
+  {
+  if ((ret = writev(fd, iov, 2)) == total_len) return;
+  if (ret != -1 || errno != EINTR) break;
+  }
+log_write(0, LOG_MAIN|LOG_PANIC_DIE,
+  "Failed writing transport result to pipe (%ld of %ld bytes): %s",
+  (long)ret, (long)total_len, ret == -1 ? strerror(errno) : "short write");
 }


/*************************************************