From: Viktor Szakats Date: Sat, 22 Nov 2025 00:42:15 +0000 (+0100) Subject: file: do not pass invalid mode flags to `open()` on upload (Windows) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=82013066a6149aa906b1fda3f8f1f27bd272a6c2;p=thirdparty%2Fcurl.git file: do not pass invalid mode flags to `open()` on upload (Windows) Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen Ref: #19645 Cherry-picked from #19643 Closes #19647 --- diff --git a/lib/file.c b/lib/file.c index 826bed6d80..6937069074 100644 --- a/lib/file.c +++ b/lib/file.c @@ -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