aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kaufmann <mail@michael-kaufmann.ch>2018-07-29 13:47:31 +0200
committerJay Satiro <raysatiro@yahoo.com>2018-07-29 14:52:02 -0400
commit3db628360ced36ad73ab75036d6fed9738f59871 (patch)
treebb744c8c823841f102769a9c57cb53a7da22413f
parentea6f57696c64149218a2f1d179afe67775d8a2be (diff)
sws: handle EINTR when calling select()
Closes https://github.com/curl/curl/pull/2808
-rw-r--r--tests/server/sws.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index ec11224f5..4879cfa8b 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -1536,18 +1536,18 @@ static void http_connect(curl_socket_t *infdp,
if(got_exit_signal)
break;
- rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
+ do {
+ rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
+ } while(rc < 0 && errno == EINTR && !got_exit_signal);
+
+ if(got_exit_signal)
+ break;
if(rc > 0) {
/* socket action */
- bool tcp_fin_wr;
+ bool tcp_fin_wr = FALSE;
timeout_count = 0;
- if(got_exit_signal)
- break;
-
- tcp_fin_wr = FALSE;
-
/* ---------------------------------------------------------- */
/* passive mode FTP may establish a secondary tunnel */
@@ -2289,7 +2289,13 @@ int main(int argc, char *argv[])
if(got_exit_signal)
goto sws_cleanup;
- rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
+ do {
+ rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
+ } while(rc < 0 && errno == EINTR && !got_exit_signal);
+
+ if(got_exit_signal)
+ goto sws_cleanup;
+
if(rc < 0) {
error = SOCKERRNO;
logmsg("select() failed with error: (%d) %s",
@@ -2297,9 +2303,6 @@ int main(int argc, char *argv[])
goto sws_cleanup;
}
- if(got_exit_signal)
- goto sws_cleanup;
-
if(rc == 0) {
/* Timed out - try again */
continue;