Curl_send/recv_plain: return errno on failure
authorDaniel Stenberg <daniel@haxx.se>
Sun, 5 Dec 2010 21:59:56 +0000 (22:59 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 5 Dec 2010 22:04:11 +0000 (23:04 +0100)
When send() and recv() fail, we now store the errno value to allow the
app to access it.

Bug: http://curl.haxx.se/bug/view.cgi?id=3128121
Reported by: Yuri

lib/sendf.c

index b73c22438cdf38fe3f595f5dd88c00b7c425dc75..d04371f84e4402ae985fc9c29c75a7739d72644f 100644 (file)
@@ -301,6 +301,7 @@ ssize_t Curl_send_plain(struct connectdata *conn, int num,
     } else {
       failf(conn->data, "Send failure: %s",
             Curl_strerror(conn, err));
+      conn->data->state.os_errno = err;
       *code = CURLE_SEND_ERROR;
     }
   }
@@ -355,6 +356,7 @@ ssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf,
     } else {
       failf(conn->data, "Recv failure: %s",
             Curl_strerror(conn, err));
+      conn->data->state.os_errno = err;
       *code = CURLE_RECV_ERROR;
     }
   }