Skip to content
Snippets Groups Projects
Commit 7a657751 authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

rts: Use long-path-aware stat

Previously `pathstat` relied on msvcrt's `stat` implementation, which was
not long-path-aware. It should rather be defined in terms of the `stat`
implementation provided by `utils/fs`.

Fixes #19541.
parent 26ba86f7
No related branches found
No related tags found
No related merge requests found
......@@ -12,10 +12,13 @@
// Use wchar_t for pathnames on Windows (#5697)
#if defined(mingw32_HOST_OS)
#include "fs_rts.h"
#define pathcmp wcscmp
#define pathlen wcslen
#define pathopen __rts_fwopen
#define pathstat _wstat
// N.B. Use the Win32-based file routines from utils/fs.
#define pathopen FS(fwopen)
#define pathstat FS(_wstat)
#define struct_stat struct _stat
#define open wopen
#define WSTR(s) L##s
......
......@@ -21,8 +21,6 @@
#include <io.h>
#include <fcntl.h>
#include <wchar.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <share.h>
#include <errno.h>
......
......@@ -25,6 +25,12 @@
#if defined(_WIN32)
#include <wchar.h>
// N.B. <sys/stat.h> defines some macro rewrites to, e.g., turn _wstat into
// _wstat64i32. We must include it here to ensure tat this rewrite applies to
// both the definition and use sites.
#include <sys/types.h>
#include <sys/stat.h>
wchar_t* FS(create_device_name) (const wchar_t*);
int FS(translate_mode) (const wchar_t*);
int FS(swopen) (const wchar_t* filename, int oflag,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment