Skip to content

Commit d57c776

Browse files
authored
fix: ensure S_ISREG is defined on Windows (#1061)
2 parents bb64d4e + bb86830 commit d57c776

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/stdlib_system.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
#ifdef _WIN32
1010
#include <direct.h>
1111
#include <windows.h>
12+
#ifndef S_ISREG
13+
#if defined(S_IFMT) && defined(S_IFREG)
14+
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
15+
#elif defined(_S_IFMT) && defined(_S_IFREG)
16+
#define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG)
17+
#endif
18+
#endif /* ifndef S_ISREG */
1219
#else
1320
#include <unistd.h>
1421
#endif /* ifdef _WIN32 */

0 commit comments

Comments
 (0)