From: Viktor Szakats Date: Fri, 21 Nov 2025 19:36:26 +0000 (+0100) Subject: lib: rename internal header `share.h` to `curl_share.h` to avoid collision X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3887069c661b40e76b053a4867eb565d4761ab3e;p=thirdparty%2Fcurl.git lib: rename internal header `share.h` to `curl_share.h` to avoid collision Windows CRTs have a `share.h`. Before this patch when trying to `#include ` it, the compiler picked up curl's internal `lib/share.h` instead. Rename it to avoid this issue. CRT `share.h` has constants necessary for using safe open CRT functions. Also rename `lib/share.c` to keep matching the header. Ref: https://learn.microsoft.com/cpp/c-runtime-library/sharing-constants Ref: 625f2c1644da58b9617479775badea21f125ce6d #16949 #16991 Cherry-picked from #19643 Closes #19676 --- diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 9c9d5c9186..cad02c8237 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -172,6 +172,7 @@ LIB_CFILES = \ curl_rtmp.c \ curl_sasl.c \ curl_sha512_256.c \ + curl_share.c \ curl_sspi.c \ curl_threads.c \ curl_trc.c \ @@ -242,7 +243,6 @@ LIB_CFILES = \ sendf.c \ setopt.c \ sha256.c \ - share.c \ slist.c \ smb.c \ smtp.c \ @@ -311,6 +311,7 @@ LIB_HFILES = \ curl_setup_once.h \ curl_sha256.h \ curl_sha512_256.h \ + curl_share.h \ curl_sspi.h \ curl_threads.h \ curl_trc.h \ @@ -376,7 +377,6 @@ LIB_HFILES = \ setup-os400.h \ setup-vms.h \ setup-win32.h \ - share.h \ sigpipe.h \ slist.h \ smb.h \ diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index e01f7ba3d2..ab57d5e00b 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -52,7 +52,7 @@ #include "sendf.h" #include "hostip.h" #include "hash.h" -#include "share.h" +#include "curl_share.h" #include "url.h" #include "multiif.h" #include "curlx/inet_pton.h" diff --git a/lib/asyn-base.c b/lib/asyn-base.c index a49e1752a5..d7e8e7d15b 100644 --- a/lib/asyn-base.c +++ b/lib/asyn-base.c @@ -51,7 +51,7 @@ #include "hash.h" #include "multiif.h" #include "select.h" -#include "share.h" +#include "curl_share.h" #include "url.h" #include "curl_memory.h" /* The last #include file should be: */ diff --git a/lib/asyn-thrdd.c b/lib/asyn-thrdd.c index 07b6663049..f4f57b547a 100644 --- a/lib/asyn-thrdd.c +++ b/lib/asyn-thrdd.c @@ -59,7 +59,7 @@ #include "sendf.h" #include "hostip.h" #include "hash.h" -#include "share.h" +#include "curl_share.h" #include "url.h" #include "multiif.h" #include "curl_threads.h" diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 0055f2d48c..2930f95fe2 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -75,7 +75,7 @@ #include "conncache.h" #include "multihandle.h" #include "rand.h" -#include "share.h" +#include "curl_share.h" #include "strdup.h" #include "system_win32.h" #include "curlx/version_win32.h" diff --git a/lib/conncache.c b/lib/conncache.c index 86dcce7138..275e490f23 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -38,7 +38,7 @@ #include "conncache.h" #include "http_negotiate.h" #include "http_ntlm.h" -#include "share.h" +#include "curl_share.h" #include "sigpipe.h" #include "connect.h" #include "select.h" diff --git a/lib/connect.c b/lib/connect.c index 4f9453907b..fbb5dcabff 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -72,7 +72,7 @@ #include "curlx/warnless.h" #include "conncache.h" #include "multihandle.h" -#include "share.h" +#include "curl_share.h" #include "http_proxy.h" #include "socks.h" diff --git a/lib/cookie.c b/lib/cookie.c index 85356d563b..6099c6ea56 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -31,7 +31,7 @@ #include "psl.h" #include "sendf.h" #include "slist.h" -#include "share.h" +#include "curl_share.h" #include "strcase.h" #include "curl_fopen.h" #include "curl_get_line.h" diff --git a/lib/share.c b/lib/curl_share.c similarity index 99% rename from lib/share.c rename to lib/curl_share.c index fdb80f5f64..b65d16c628 100644 --- a/lib/share.c +++ b/lib/curl_share.c @@ -27,7 +27,7 @@ #include #include "urldata.h" #include "connect.h" -#include "share.h" +#include "curl_share.h" #include "psl.h" #include "vtls/vtls.h" #include "vtls/vtls_scache.h" diff --git a/lib/share.h b/lib/curl_share.h similarity index 100% rename from lib/share.h rename to lib/curl_share.h diff --git a/lib/doh.c b/lib/doh.c index 636f0f41cf..45524edf4c 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -33,7 +33,7 @@ #include "sendf.h" #include "multiif.h" #include "url.h" -#include "share.h" +#include "curl_share.h" #include "curlx/base64.h" #include "connect.h" #include "strdup.h" diff --git a/lib/easy.c b/lib/easy.c index 54896a8d55..8c7b9c23da 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -53,7 +53,7 @@ #include "url.h" #include "getinfo.h" #include "hostip.h" -#include "share.h" +#include "curl_share.h" #include "strdup.h" #include "progress.h" #include "easyif.h" diff --git a/lib/hostip.c b/lib/hostip.c index 48889dcb43..d5f753f4b4 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -50,7 +50,7 @@ #include "hostip.h" #include "hash.h" #include "rand.h" -#include "share.h" +#include "curl_share.h" #include "url.h" #include "curlx/inet_ntop.h" #include "curlx/inet_pton.h" diff --git a/lib/hostip4.c b/lib/hostip4.c index e1ed007aaf..d543c1e14b 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -47,7 +47,7 @@ #include "sendf.h" #include "hostip.h" #include "hash.h" -#include "share.h" +#include "curl_share.h" #include "url.h" /* The last 2 #include files should be in this order */ diff --git a/lib/hostip6.c b/lib/hostip6.c index 9419b9e4d5..0f628b3fb5 100644 --- a/lib/hostip6.c +++ b/lib/hostip6.c @@ -48,7 +48,7 @@ #include "sendf.h" #include "hostip.h" #include "hash.h" -#include "share.h" +#include "curl_share.h" #include "url.h" #include "curlx/inet_pton.h" #include "connect.h" diff --git a/lib/hsts.c b/lib/hsts.c index ec332392c4..836481cd4c 100644 --- a/lib/hsts.c +++ b/lib/hsts.c @@ -37,7 +37,7 @@ #include "sendf.h" #include "parsedate.h" #include "rename.h" -#include "share.h" +#include "curl_share.h" #include "strdup.h" #include "curlx/strparse.h" diff --git a/lib/http.c b/lib/http.c index a1e449d354..ae932cd7c9 100644 --- a/lib/http.c +++ b/lib/http.c @@ -65,7 +65,7 @@ #include "http_aws_sigv4.h" #include "url.h" #include "urlapi-int.h" -#include "share.h" +#include "curl_share.h" #include "hostip.h" #include "dynhds.h" #include "http.h" diff --git a/lib/multi.c b/lib/multi.c index 5ea93348e4..00af3ca2bd 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -33,7 +33,7 @@ #include "connect.h" #include "progress.h" #include "easyif.h" -#include "share.h" +#include "curl_share.h" #include "psl.h" #include "multiif.h" #include "multi_ev.h" diff --git a/lib/psl.c b/lib/psl.c index 832d6d21b9..f645763d06 100644 --- a/lib/psl.c +++ b/lib/psl.c @@ -29,7 +29,7 @@ #ifdef USE_LIBPSL #include "psl.h" -#include "share.h" +#include "curl_share.h" /* The last 2 #include files should be in this order */ #include "curl_memory.h" diff --git a/lib/setopt.c b/lib/setopt.c index 1147deb116..fc95389312 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -41,7 +41,7 @@ #include "progress.h" #include "content_encoding.h" #include "strcase.h" -#include "share.h" +#include "curl_share.h" #include "vtls/vtls.h" #include "curlx/warnless.h" #include "sendf.h" diff --git a/lib/url.c b/lib/url.c index f9b1ed0808..1d4c6b1fc4 100644 --- a/lib/url.c +++ b/lib/url.c @@ -81,7 +81,7 @@ #include "cookie.h" #include "strcase.h" #include "escape.h" -#include "share.h" +#include "curl_share.h" #include "content_encoding.h" #include "http_digest.h" #include "http_negotiate.h" diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index ed0af3d53b..d116ec91ed 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -63,7 +63,7 @@ #include "../strcase.h" #include "../url.h" #include "../progress.h" -#include "../share.h" +#include "../curl_share.h" #include "../multiif.h" #include "../curlx/fopen.h" #include "../curlx/timeval.h" diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index 328b12403e..3524a25a44 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -41,7 +41,7 @@ #include "../strcase.h" #include "../url.h" #include "../llist.h" -#include "../share.h" +#include "../curl_share.h" #include "../curl_trc.h" #include "../curl_sha256.h" #include "../rand.h" diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c index 089caa1c45..3e4d53d0be 100644 --- a/tests/unit/unit1607.c +++ b/tests/unit/unit1607.c @@ -25,7 +25,7 @@ #include "urldata.h" #include "connect.h" -#include "share.h" +#include "curl_share.h" #include "memdebug.h" /* LAST include file */ diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c index 00164617f5..f3f318f2cf 100644 --- a/tests/unit/unit1609.c +++ b/tests/unit/unit1609.c @@ -25,7 +25,7 @@ #include "urldata.h" #include "connect.h" -#include "share.h" +#include "curl_share.h" #include "memdebug.h" /* LAST include file */