From 6f1d1a508490853506c7708de25c41d6b61ee27d Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Mon, 28 Dec 2009 03:13:49 +0000 Subject: [PATCH] O_BINARY for Windows. --- lib/libarchive/archive_read_open_fd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libarchive/archive_read_open_fd.c b/lib/libarchive/archive_read_open_fd.c index 259ddc28be59..8a7829b7fb0a 100644 --- a/lib/libarchive/archive_read_open_fd.c +++ b/lib/libarchive/archive_read_open_fd.c @@ -32,6 +32,12 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include #endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_STDLIB_H #include #endif @@ -95,6 +101,9 @@ archive_read_open_fd(struct archive *a, int fd, size_t block_size) mine->can_skip = 1; } else mine->can_skip = 0; +#if defined(__CYGWIN__) || defined(_WIN32) + setmode(mine->fd, O_BINARY); +#endif return (archive_read_open2(a, mine, NULL, file_read, file_skip, file_close));