v2-0001-Fixed-Windows-stat-emulation-working-with-streams.patch
application/octet-stream
Filename: v2-0001-Fixed-Windows-stat-emulation-working-with-streams.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
Series: patch v2-0001
| File | + | − |
|---|---|---|
| src/port/win32stat.c | 15 | 1 |
diff --git a/src/port/win32stat.c b/src/port/win32stat.c
index 2ad8ee1..535abf2 100644
--- a/src/port/win32stat.c
+++ b/src/port/win32stat.c
@@ -288,7 +288,21 @@ _pgstat64(const char *name, struct stat *buf)
int
_pgfstat64(int fileno, struct stat *buf)
{
- HANDLE hFile = (HANDLE) _get_osfhandle(fileno);
+ HANDLE hFile;
+
+ /* Check for data streams: stdin, stdout, stderr */
+ switch(fileno)
+ {
+ case 0:
+ case 1:
+ case 2:
+ memset(buf, 0, sizeof(*buf));
+ buf->st_mode = _S_IFIFO;
+ buf->st_dev = fileno;
+ return 0;
+ default :
+ hFile = (HANDLE) _get_osfhandle(fileno);
+ }
if (hFile == INVALID_HANDLE_VALUE || buf == NULL)
{