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
This commit is contained in:
Viktor Szakats 2025-11-22 01:42:15 +01:00
parent 537987d8c6
commit 82013066a6
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201

View 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