aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-05-02 06:02:13 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-05-02 06:02:13 +0000
commit6c8e6549d0d22716c0138a7e25c85b8cb3f2b0ac (patch)
tree79e21eaece7f88228274c46b15a129cad76302bb /tests
parenteec105daba5934d78281718252490b9b57fe8156 (diff)
Check the return code from curl_multi_add_handle()
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/lib536.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/libtest/lib536.c b/tests/libtest/lib536.c
index 7ab2aa3f0..6b0a6a223 100644
--- a/tests/libtest/lib536.c
+++ b/tests/libtest/lib536.c
@@ -19,8 +19,6 @@
#define MAIN_LOOP_HANG_TIMEOUT 90 * 1000
#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
-static CURLMcode perform(CURLM * multi);
-
static CURLMcode perform(CURLM * multi)
{
int handles, maxfd;
@@ -72,6 +70,7 @@ int test(char *URL)
{
CURLM *multi;
CURL *easy;
+ int res = 0;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
@@ -97,26 +96,34 @@ int test(char *URL)
curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
curl_easy_setopt(easy, CURLOPT_URL, URL);
- curl_multi_add_handle(multi, easy);
- if (perform(multi) != CURLM_OK)
- printf("retrieve 1 failed\n");
+ if (curl_multi_add_handle(multi, easy) != CURLM_OK) {
+ printf("curl_multi_add_handle() failed\n");
+ res = TEST_ERR_MAJOR_BAD;
+ } else {
+ if (perform(multi) != CURLM_OK)
+ printf("retrieve 1 failed\n");
- curl_multi_remove_handle(multi, easy);
+ curl_multi_remove_handle(multi, easy);
+ }
curl_easy_reset(easy);
curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
curl_easy_setopt(easy, CURLOPT_URL, arg2);
- curl_multi_add_handle(multi, easy);
- if (perform(multi) != CURLM_OK)
- printf("retrieve 2 failed\n");
+ if (curl_multi_add_handle(multi, easy) != CURLM_OK) {
+ printf("curl_multi_add_handle() 2 failed\n");
+ res = TEST_ERR_MAJOR_BAD;
+ } else {
+ if (perform(multi) != CURLM_OK)
+ printf("retrieve 2 failed\n");
- curl_multi_remove_handle(multi, easy);
+ curl_multi_remove_handle(multi, easy);
+ }
curl_easy_cleanup(easy);
curl_multi_cleanup(multi);
curl_global_cleanup();
printf("Finished!\n");
- return 0;
+ return res;
}