]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: rename internal header `share.h` to `curl_share.h` to avoid collision
authorViktor Szakats <commit@vsz.me>
Fri, 21 Nov 2025 19:36:26 +0000 (20:36 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 24 Nov 2025 23:26:50 +0000 (00:26 +0100)
Windows CRTs have a `share.h`. Before this patch when trying to
`#include <share.h>` 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

25 files changed:
lib/Makefile.inc
lib/asyn-ares.c
lib/asyn-base.c
lib/asyn-thrdd.c
lib/cf-socket.c
lib/conncache.c
lib/connect.c
lib/cookie.c
lib/curl_share.c [moved from lib/share.c with 99% similarity]
lib/curl_share.h [moved from lib/share.h with 100% similarity]
lib/doh.c
lib/easy.c
lib/hostip.c
lib/hostip4.c
lib/hostip6.c
lib/hsts.c
lib/http.c
lib/multi.c
lib/psl.c
lib/setopt.c
lib/url.c
lib/vtls/vtls.c
lib/vtls/vtls_scache.c
tests/unit/unit1607.c
tests/unit/unit1609.c

index 9c9d5c918691a37f57843e940c5dc2ff46a83215..cad02c8237860dbc218fcd93b8e208d64844abff 100644 (file)
@@ -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              \
index e01f7ba3d24e38bc78d3989282f7ac936bc5e107..ab57d5e00b4152c9feee4fef322767ba476bd8ae 100644 (file)
@@ -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"
index a49e1752a57a3c5e0eb6729435f63a2ecb261287..d7e8e7d15b8686dcf0db03d7c8501fe9d95f3626 100644 (file)
@@ -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: */
index 07b666304910961ac9cb36879b70b0d09fe5e58a..f4f57b547a018b0376cbbff776d7c5f83f781035 100644 (file)
@@ -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"
index 0055f2d48c92a4ec7ad6b1178246527daad59d3f..2930f95fe24cab5fe063dc55dc6b44767b3d53c0 100644 (file)
@@ -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"
index 86dcce7138e6b3131e8ce1af322082f8d0edfb24..275e490f23e83a616553876a33f5367a30db7bfe 100644 (file)
@@ -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"
index 4f9453907b0cee4881bda1ed42735df8337c7041..fbb5dcabff26d97909b413cf9fa05f71e6d1aed9 100644 (file)
@@ -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"
 
index 85356d563bb1afd67b9030e91c0d0851521b3eef..6099c6ea560dffe6c4cd5c99946d27c2868536fb 100644 (file)
@@ -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"
similarity index 99%
rename from lib/share.c
rename to lib/curl_share.c
index fdb80f5f64abff019cc68fda659ca7679bfbcd67..b65d16c6281f64a33500be73261ac97b89675113 100644 (file)
@@ -27,7 +27,7 @@
 #include <curl/curl.h>
 #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"
similarity index 100%
rename from lib/share.h
rename to lib/curl_share.h
index 636f0f41cf24872cec96c87797c24f0a4a2bb705..45524edf4c0bd0fa7373e255bf8665dc560b10cc 100644 (file)
--- 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"
index 54896a8d55b47a8ad7fc109e4d54c07b29de5b50..8c7b9c23da68b0dd534ad787edd3471be4ed41da 100644 (file)
@@ -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"
index 48889dcb43bc84272d21ac3d3953946e590aaa80..d5f753f4b4a7e2993ec2c8958593d3b7f037c1c4 100644 (file)
@@ -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"
index e1ed007aafa37392a1486140ac66f9e4804029b1..d543c1e14b198fc801993f943b7fb8450a888f4a 100644 (file)
@@ -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 */
index 9419b9e4d5feb3a3d950c50bbf944621bbdaecb0..0f628b3fb5cabd206daf828213db2a66b7c4c41d 100644 (file)
@@ -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"
index ec332392c429f655da7954177654d70852edcaf9..836481cd4c36cf959baf7f5a7a1cab6aaae2db0b 100644 (file)
@@ -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"
 
index a1e449d35441ee968c64158cc8158c9b50ba6f3a..ae932cd7c93a565753db005209ca700cd6215ac7 100644 (file)
@@ -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"
index 5ea93348e4e50333ada1fa853e96ddfc02346282..00af3ca2bddfc1893f24bce8404bd660ee442fd1 100644 (file)
@@ -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"
index 832d6d21b94a6fafd1d05056e9156580c1e47d5a..f645763d063b7005b4c17f6057f83186dd4312ba 100644 (file)
--- 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"
index 1147deb1162f018f7a97daa21f1881c43f27b7cb..fc95389312ad68517b9bdf6f39139f97eed00a22 100644 (file)
@@ -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"
index f9b1ed0808e7cacd6abe27f08ab19f3b56bc4fde..1d4c6b1fc419360a64c82182bf87fae122ce518f 100644 (file)
--- 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"
index ed0af3d53b912379dd8cf9811d7afa9504f4cdd0..d116ec91edb39f0f910bbbf230973eeeef843fdd 100644 (file)
@@ -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"
index 328b12403e9b0ed05f5b25ff18e0b752603e2116..3524a25a4417e012d46ca9713353ff63be8b8a97 100644 (file)
@@ -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"
index 089caa1c45b80ac11a8ca23533c7baa864134fac..3e4d53d0be5e6ecea311ff05de51515171709093 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "urldata.h"
 #include "connect.h"
-#include "share.h"
+#include "curl_share.h"
 
 #include "memdebug.h" /* LAST include file */
 
index 00164617f522598f8a0ea000f4c34291c343d284..f3f318f2cf9790aa0b08856f96820495d404d6e6 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "urldata.h"
 #include "connect.h"
-#include "share.h"
+#include "curl_share.h"
 
 #include "memdebug.h" /* LAST include file */