]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
file: fix Android compiler warning
authorViktor Szakats <commit@vsz.me>
Wed, 1 Jan 2025 02:28:09 +0000 (03:28 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 1 Jan 2025 11:44:20 +0000 (12:44 +0100)
Apply the fix already used in `lib/fopen.c`.

```
lib/file.c:326:41: warning: implicit conversion loses integer precision: 'unsigned int' to 'mode_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
  326 |   fd = open(file->path, mode, data->set.new_file_perms);
      |        ~~~~                   ~~~~~~~~~~^~~~~~~~~~~~~~
```

Closes #15883

lib/file.c

index a2bf1cc1c9c31a183e6d6896d4c58c1d50e68e0f..f8535d9449ef578cbef639d6944b4382a0609d9a 100644 (file)
@@ -323,7 +323,12 @@ static CURLcode file_upload(struct Curl_easy *data)
   else
     mode = MODE_DEFAULT|O_TRUNC;
 
+#if (defined(ANDROID) || defined(__ANDROID__)) && \
+    (defined(__i386__) || defined(__arm__))
+  fd = open(file->path, mode, (mode_t)data->set.new_file_perms);
+#else
   fd = open(file->path, mode, data->set.new_file_perms);
+#endif
   if(fd < 0) {
     failf(data, "cannot open %s for writing", file->path);
     return CURLE_WRITE_ERROR;