summaryrefslogtreecommitdiff
path: root/src/include/port/win32_port.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/port/win32_port.h')
-rw-r--r--src/include/port/win32_port.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h
index f65f426cdbd..1ed65fefff6 100644
--- a/src/include/port/win32_port.h
+++ b/src/include/port/win32_port.h
@@ -270,10 +270,11 @@ struct stat /* This should match struct __stat64 */
extern int _pgfstat64(int fileno, struct stat *buf);
extern int _pgstat64(const char *name, struct stat *buf);
+extern int _pglstat64(const char *name, struct stat *buf);
#define fstat(fileno, sb) _pgfstat64(fileno, sb)
#define stat(path, sb) _pgstat64(path, sb)
-#define lstat(path, sb) _pgstat64(path, sb)
+#define lstat(path, sb) _pglstat64(path, sb)
/* These macros are not provided by older MinGW, nor by MSVC */
#ifndef S_IRUSR
@@ -320,6 +321,21 @@ extern int _pgstat64(const char *name, struct stat *buf);
#endif
/*
+ * In order for lstat() to be able to report junction points as symlinks, we
+ * need to hijack a bit in st_mode, since neither MSVC nor MinGW provides
+ * S_ISLNK and there aren't any spare bits. We'll steal the one for character
+ * devices, because we don't otherwise make use of those.
+ */
+#ifdef S_ISLNK
+#error "S_ISLNK is already defined"
+#endif
+#ifdef S_IFLNK
+#error "S_IFLNK is already defined"
+#endif
+#define S_IFLNK S_IFCHR
+#define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK)
+
+/*
* Supplement to <fcntl.h>.
* This is the same value as _O_NOINHERIT in the MS header file. This is
* to ensure that we don't collide with a future definition. It means