speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] Retry read calls in module_utils.c, if they fail with EINTR


From: Rui Batista
Subject: [PATCH] Retry read calls in module_utils.c, if they fail with EINTR
Date: Tue, 10 Aug 2010 18:25:21 +0100

---
 src/modules/module_utils.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/modules/module_utils.c b/src/modules/module_utils.c
index 29bd479..a5053a4 100644
--- a/src/modules/module_utils.c
+++ b/src/modules/module_utils.c
@@ -834,7 +834,11 @@ int
 module_child_dp_read(TModuleDoublePipe dpipe, char *msg, size_t maxlen)
 {
     int bytes;
-    bytes = read(dpipe.pc[0], msg, maxlen);    
+    while ((bytes = read(dpipe.pc[0], msg, maxlen)) < 0) {
+        if (errno != EINTR) {
+            FATAL("Unable to read data");
+        }
+    }
     return bytes;
 }
 
@@ -842,7 +846,11 @@ int
 module_parent_dp_read(TModuleDoublePipe dpipe, char *msg, size_t maxlen)
 {
     int bytes;
-    bytes = read(dpipe.cp[0], msg, maxlen);    
+    while ((bytes = read(dpipe.cp[0], msg, maxlen)) < 0) {
+        if (errno != EINTR) {
+            FATAL("Unable to read data");
+        }
+    }
     return bytes;
 }
 
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]