From: Daniel Stenberg Date: Mon, 31 Mar 2025 21:47:23 +0000 (+0200) Subject: lib1960: revert the use of libcurl's inet_pton X-Git-Tag: curl-8_14_0~401 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a45c2851aeb6f3ec18ad5c39c4042ab516891dd;p=thirdparty%2Fcurl.git lib1960: revert the use of libcurl's inet_pton Since it now uses hex conversion code from strparse as well. Closes #16888 --- diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index 7b7b2078b2..b93177f6fb 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -26,7 +26,6 @@ TESTUTIL = testutil.c testutil.h TSTTRACE = testtrace.c testtrace.h WARNLESS = ../../lib/warnless.c ../../lib/warnless.h MULTIBYTE = ../../lib/curl_multibyte.c ../../lib/curl_multibyte.h -INET_PTON = ../../lib/inet_pton.c ../../lib/inet_pton.h THREADS = ../../lib/curl_threads.c ../../lib/curl_threads.h # these files are used in every single test program below @@ -657,7 +656,7 @@ lib1958_LDADD = $(TESTUTIL_LIBS) lib1959_SOURCES = lib1959.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1959_LDADD = $(TESTUTIL_LIBS) -lib1960_SOURCES = lib1960.c $(SUPPORTFILES) $(INET_PTON) +lib1960_SOURCES = lib1960.c $(SUPPORTFILES) lib1960_LDADD = $(TESTUTIL_LIBS) lib1964_SOURCES = lib1964.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) diff --git a/tests/libtest/lib1960.c b/tests/libtest/lib1960.c index 33947a71d6..dc9eb9c7b4 100644 --- a/tests/libtest/lib1960.c +++ b/tests/libtest/lib1960.c @@ -23,7 +23,18 @@ ***************************************************************************/ #include "test.h" -#include "inet_pton.h" +#ifdef HAVE_INET_PTON + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + #include "memdebug.h" /* to prevent libcurl from closing our socket */ @@ -56,6 +67,13 @@ static int sockopt_cb(void *clientp, return CURL_SOCKOPT_ALREADY_CONNECTED; } +#if defined(__AMIGA__) +#define my_inet_pton(x,y,z) inet_pton(x,(unsigned char *)y,z) +#else +#define my_inet_pton(x,y,z) inet_pton(x,y,z) +#endif + + /* Expected args: URL IP PORT */ CURLcode test(char *URL) { @@ -90,7 +108,7 @@ CURLcode test(char *URL) serv_addr.sin_family = AF_INET; serv_addr.sin_port = htons(port); - if(curlx_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) { + if(my_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) { fprintf(stderr, "inet_pton failed\n"); goto test_cleanup; } @@ -128,3 +146,11 @@ test_cleanup: return res; } +#else +CURLcode test(char *URL) +{ + (void)URL; + printf("lacks inet_pton\n"); + return CURLE_OK; +} +#endif