]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_dirhie: stop redefining system symbol `mkdir`
authorViktor Szakats <commit@vsz.me>
Fri, 27 Mar 2026 23:02:04 +0000 (00:02 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 30 Mar 2026 11:46:14 +0000 (13:46 +0200)
Replace with local macro `toolx_mkdir()`, and map that to
platform-specific implementations as necessary.

Closes #21133

src/tool_dirhie.c

index 69011898ee53d52bff2596f6714a4bab86ad4e29..894c63803407c3c17047cbf37f2effdf32e353e7 100644 (file)
 
 #ifdef _WIN32
 #  include <direct.h>
-#  define mkdir(x, y) _mkdir(x)
+#  define toolx_mkdir(x, y) _mkdir(x)
 #elif defined(MSDOS) && !defined(__DJGPP__)
-#  define mkdir(x, y) (mkdir)(x)
+#  define toolx_mkdir(x, y) mkdir(x)
+#else
+#  define toolx_mkdir mkdir
 #endif
 
 static void show_dir_errno(const char *name)
@@ -120,7 +122,7 @@ CURLcode create_dir_hierarchy(const char *outfile)
 
     /* Create directory. Ignore access denied error to allow traversal. */
     /* !checksrc! disable ERRNOVAR 1 */
-    if(!skip && (mkdir(curlx_dyn_ptr(&dirbuf), (mode_t)0000750) == -1) &&
+    if(!skip && (toolx_mkdir(curlx_dyn_ptr(&dirbuf), (mode_t)0000750) == -1) &&
        (errno != EACCES) && (errno != EEXIST)) {
       show_dir_errno(curlx_dyn_ptr(&dirbuf));
       result = CURLE_WRITE_ERROR;