summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-06-27 16:05:32 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-06-27 23:20:18 +0200
commitca60a4398fc82e43e3b7caeff811db1ac5370dd0 (patch)
treeedac41149600a2e4c0c92cfe55aecfaf5e8a70fa /tests
parent68d651f6b6a313c8cf15b5c9049e6b87197fd2b8 (diff)
downloadcurl-ca60a4398fc82e43e3b7caeff811db1ac5370dd0.tar.gz
lib677: make it survive torture testing
Follow-up to a5ab72d5edd7 Closes #7300
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/lib677.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/libtest/lib677.c b/tests/libtest/lib677.c
index 48d5919fe..a4ec667f2 100644
--- a/tests/libtest/lib677.c
+++ b/tests/libtest/lib677.c
@@ -31,7 +31,7 @@ static char buf[1024];
int test(char *URL)
{
CURLM *mcurl;
- CURL *curl;
+ CURL *curl = NULL;
int mrun;
curl_socket_t sock = CURL_SOCKET_BAD;
time_t start = time(NULL);
@@ -41,20 +41,23 @@ int test(char *URL)
curl_global_init(CURL_GLOBAL_DEFAULT);
mcurl = curl_multi_init();
if(!mcurl)
- return 1;
+ goto fail;
curl = curl_easy_init();
if(!curl)
goto fail;
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl, CURLOPT_URL, URL);
+ if(curl_easy_setopt(curl, CURLOPT_URL, URL))
+ goto fail;
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
- curl_multi_add_handle(mcurl, curl);
+ if(curl_multi_add_handle(mcurl, curl))
+ goto fail;
while(time(NULL) - start < 5) {
struct curl_waitfd waitfd;
- curl_multi_perform(mcurl, &mrun);
+ if(curl_multi_perform(mcurl, &mrun))
+ goto fail;
for(;;) {
int i;
struct CURLMsg *m = curl_multi_info_read(mcurl, &i);
@@ -64,7 +67,7 @@ int test(char *URL)
if(m->msg == CURLMSG_DONE && m->easy_handle == curl) {
curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sock);
if(sock == CURL_SOCKET_BAD)
- return 3;
+ goto fail;
printf("Connected fine, extracted socket. Moving on\n");
}
}