summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-03-15 19:42:43 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-23 13:00:37 -0400
commit7a6577513633b943202fc82ab7aa162e1d293c0a (patch)
tree704cdebde25170300f9d244582957a8efe9edf65 /utils
parent26ba86f73c9125c03968aec88be919bdd6a2152b (diff)
downloadhaskell-7a6577513633b943202fc82ab7aa162e1d293c0a.tar.gz
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.
Diffstat (limited to 'utils')
-rw-r--r--utils/fs/fs.c2
-rw-r--r--utils/fs/fs.h6
2 files changed, 6 insertions, 2 deletions
diff --git a/utils/fs/fs.c b/utils/fs/fs.c
index ebed2ca0fc..a5377af7e2 100644
--- a/utils/fs/fs.c
+++ b/utils/fs/fs.c
@@ -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>
diff --git a/utils/fs/fs.h b/utils/fs/fs.h
index 9e4b8e2052..6c5f56ccdd 100644
--- a/utils/fs/fs.h
+++ b/utils/fs/fs.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,