]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
file: do not pass invalid mode flags to `open()` on upload (Windows)
authorViktor Szakats <commit@vsz.me>
Sat, 22 Nov 2025 00:42:15 +0000 (01:42 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 24 Nov 2025 13:29:39 +0000 (14:29 +0100)
Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen

Ref: #19645
Cherry-picked from #19643
Closes #19647

lib/file.c

index 826bed6d802cc0ea7b5e03a502f51a56d0a3cd08..69370690746e54abff4728fb1db6b8653e3c43e1 100644 (file)
@@ -343,7 +343,10 @@ static CURLcode file_upload(struct Curl_easy *data,
   else
     mode |= O_TRUNC;
 
-#if (defined(ANDROID) || defined(__ANDROID__)) && \
+#ifdef _WIN32
+  fd = curlx_open(file->path, mode,
+                  data->set.new_file_perms & (_S_IREAD | _S_IWRITE));
+#elif (defined(ANDROID) || defined(__ANDROID__)) && \
   (defined(__i386__) || defined(__arm__))
   fd = curlx_open(file->path, mode, (mode_t)data->set.new_file_perms);
 #else