cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH 1/2] easy: do not ignore poll() failures other than EINTR

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Mon, 11 Mar 2013 17:19:13 +0100

---
 RELEASE-NOTES |    1 +
 lib/easy.c    |   12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 3594c62..b41a566 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -53,6 +53,7 @@ This release includes the following bugfixes:
  o docs: updates HTML index and general improvements
  o curlbuild.h.dist: enhance non-configure GCC ABI detection logic
  o sasl: Fixed null pointer reference when decoding empty digest challenge [8]
+ o easy: do not ignore poll() failures other than EINTR
 
 This release includes the following known bugs:
 
diff --git a/lib/easy.c b/lib/easy.c
index c27deff..2e747bb 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -441,11 +441,19 @@ CURLcode curl_easy_perform(CURL *easy)
 
   while(!done && !mcode) {
     int still_running;
+    int ret;
 
-    mcode = curl_multi_wait(multi, NULL, 0, 1000, NULL);
+    mcode = curl_multi_wait(multi, NULL, 0, 1000, &ret);
+
+    if(mcode == CURLM_OK) {
+      if(ret == -1) {
+        /* poll() failed not on EINTR, indicate a network problem */
+        code = CURLE_RECV_ERROR;
+        break;
+      }
 
-    if(mcode == CURLM_OK)
       mcode = curl_multi_perform(multi, &still_running);
+    }
 
     /* only read 'still_running' if curl_multi_perform() return OK */
     if((mcode == CURLM_OK) && !still_running) {
-- 
1.7.1
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-11