]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multibyte: Fixed access-> waccess to file for Windows Plarform
authorValentyn Korniienko <kornienko-vr@rambler.ru>
Thu, 18 Jun 2020 13:26:13 +0000 (16:26 +0300)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 21 Jun 2020 17:31:39 +0000 (19:31 +0200)
Reviewed-by: Marcel Raad
Closes #5580

lib/curl_multibyte.c
lib/curl_setup.h

index 5345d7b366801ee97f22135ff3ec88b818b3fab6..2c8925b531087c41c05da34ea508a0417049ed1b 100644 (file)
@@ -129,4 +129,25 @@ int curlx_win32_stat(const char *path, struct_stat *buffer)
   return result;
 }
 
+int curlx_win32_access(const char *path, int mode)
+{
+    int result = -1;
+#ifdef _UNICODE
+    wchar_t *path_w = curlx_convert_UTF8_to_wchar(path);
+#endif /* _UNICODE */
+
+#if defined(_UNICODE)
+    if(path_w)
+        result = _waccess(path_w, mode);
+    else
+#endif /* _UNICODE */
+        result = _access(path, mode);
+
+#ifdef _UNICODE
+    free(path_w);
+#endif
+
+    return result;
+}
+
 #endif /* USE_WIN32_LARGE_FILES || USE_WIN32_SMALL_FILES */
index 82b962b89afb2174fec7cf1aed2b0021f91881e7..d76c630d05106170372e74ad5d1fceb5e7dee6e3 100644 (file)
 #  define struct_stat                struct _stati64
 #  define LSEEK_ERROR                (__int64)-1
 #  define fopen(fname,mode)          curlx_win32_fopen(fname, mode)
+#  define access(fname,mode)         curlx_win32_access(fname, mode)
    int curlx_win32_stat(const char *path, struct_stat *buffer);
    FILE *curlx_win32_fopen(const char *filename, const char *mode);
+   int curlx_win32_access(const char *path, int mode);
 #endif
 
 /*
 #    define stat(fname,stp)            curlx_win32_stat(fname, stp)
 #    define struct_stat                struct _stat
 #    define fopen(fname,mode)          curlx_win32_fopen(fname, mode)
+#    define access(fname,mode)         curlx_win32_access(fname, mode)
      int curlx_win32_stat(const char *path, struct_stat *buffer);
      FILE *curlx_win32_fopen(const char *filename, const char *mode);
+     int curlx_win32_access(const char *path, int mode);
 #  endif
 #  define LSEEK_ERROR                (long)-1
 #endif