]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
make the loop use a fixed number of attempts to prevent eternal loops
authorDaniel Stenberg <daniel@haxx.se>
Tue, 27 Apr 2004 10:59:43 +0000 (10:59 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 27 Apr 2004 10:59:43 +0000 (10:59 +0000)
tests/libtest/lib504.c

index bfffd39711f65b337faefc6251a2b4af5b850fa9..5f2c6acfc63e8f30bb8ae84bc250997748a1527c 100644 (file)
@@ -20,6 +20,7 @@ int test(char *URL)
   int running;
   int max_fd;
   int rc;
+  int loop=100;
 
   curl_global_init(CURL_GLOBAL_ALL);
   c = curl_easy_init();
@@ -78,7 +79,9 @@ int test(char *URL)
     rc = select(max_fd+1, &rd, &wr, &exc, &interval);
     fprintf(stderr, "select returned %d\n", rc);
     
-  } while(rc);
+    /* we only allow a certain number of loops to avoid hanging here
+       forever */
+  } while(rc && (--loop>0));
 
   curl_multi_remove_handle(m, c);
   curl_easy_cleanup(c);