aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-10-27 03:00:47 +0000
committerYang Tse <yangsita@gmail.com>2008-10-27 03:00:47 +0000
commit39e5fa6ae86c0df6c59da8c732ea8f5db35257fd (patch)
tree825a657d676f18c64a888d295a46478a2e18b29a /tests
parentdc289aa4fa4ea381237be28372b4eaf5c87a86de (diff)
avoid using Curl_ip2addr(), simply build up a fake Curl_addrinfo
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/lib558.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/libtest/lib558.c b/tests/libtest/lib558.c
index bf4f9149f..9dabbb718 100644
--- a/tests/libtest/lib558.c
+++ b/tests/libtest/lib558.c
@@ -26,6 +26,35 @@
#include "memory.h"
#include "memdebug.h"
+
+static Curl_addrinfo *fake_ai(void)
+{
+ Curl_addrinfo *ai;
+ int ss_size;
+
+ ss_size = sizeof (struct sockaddr_in);
+
+ if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL)
+ return NULL;
+
+ if((ai->ai_canonname = strdup("dummy")) == NULL) {
+ free(ai);
+ return NULL;
+ }
+
+ if((ai->ai_addr = calloc(1, ss_size)) == NULL) {
+ free(ai->ai_canonname);
+ free(ai);
+ return NULL;
+ }
+
+ ai->ai_family = AF_INET;
+ ai->ai_addrlen = ss_size;
+
+ return ai;
+}
+
+
int test(char *URL)
{
CURL *easyh;
@@ -67,7 +96,7 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- data_node->addr = Curl_ip2addr(INADDR_ANY, "dummy", 0);
+ data_node->addr = fake_ai();
if(!data_node->addr) {
printf("actual data creation failed\n");
return TEST_ERR_MAJOR_BAD;