summaryrefslogtreecommitdiff
path: root/libarchive/archive_windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_windows.c')
-rw-r--r--libarchive/archive_windows.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c
index f613b174..492ced07 100644
--- a/libarchive/archive_windows.c
+++ b/libarchive/archive_windows.c
@@ -677,6 +677,10 @@ __la_read(int fd, void *buf, size_t nbytes)
errno = EBADF;
return (-1);
}
+ /* Do not pass 0 to third parameter of ReadFile(), read bytes.
+ * This will not return to application size. */
+ if (nbytes == 0)
+ return (0);
handle = (HANDLE)_get_osfhandle(fd);
if (GetFileType(handle) == FILE_TYPE_PIPE) {
DWORD sta;