diff options
author | kientzle <kientzle@FreeBSD.org> | 2009-12-28 02:28:44 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2009-12-28 02:28:44 +0000 |
commit | 0ce60e88585927fbd1fa9091e99da0b4694b6d28 (patch) | |
tree | c21b2ba1494e4d0b9d1aa0805098a416bc7e0453 /lib/libarchive/archive_read_open_file.c | |
parent | 110ffdeb53f5a023d37d975a2a3df6c30a27f1fa (diff) | |
download | FreeBSD-src-0ce60e88585927fbd1fa9091e99da0b4694b6d28.zip FreeBSD-src-0ce60e88585927fbd1fa9091e99da0b4694b6d28.tar.gz |
Portability: Set the file descriptor to binary mode on Win32
Diffstat (limited to 'lib/libarchive/archive_read_open_file.c')
-rw-r--r-- | lib/libarchive/archive_read_open_file.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libarchive/archive_read_open_file.c b/lib/libarchive/archive_read_open_file.c index 37039e9..1575f94 100644 --- a/lib/libarchive/archive_read_open_file.c +++ b/lib/libarchive/archive_read_open_file.c @@ -35,6 +35,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif +#ifdef HAVE_IO_H +#include <io.h> +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif @@ -94,6 +97,10 @@ archive_read_open_FILE(struct archive *a, FILE *f) } else mine->can_skip = 0; +#if defined(__CYGWIN__) || defined(_WIN32) + setmode(fileno(mine->f), O_BINARY); +#endif + return (archive_read_open2(a, mine, NULL, file_read, file_skip, file_close)); } |