aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/fstream/win32/istream.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/fstream/win32/istream.c b/lib/fstream/win32/istream.c
index 36d7c42..b591584 100644
--- a/lib/fstream/win32/istream.c
+++ b/lib/fstream/win32/istream.c
@@ -30,6 +30,16 @@ static int file_precache(istream_t *strm)
if (!ReadFile(hnd, strm->buffer + strm->buffer_used,
diff, &actual, NULL)) {
+ DWORD error = GetLastError();
+
+ if (error == ERROR_HANDLE_EOF ||
+ error == ERROR_BROKEN_PIPE) {
+ strm->eof = true;
+ break;
+ }
+
+ SetLastError(error);
+
w32_perror(file->path == NULL ? "stdin" : file->path);
return -1;
}