diff options
author | Tim Kientzle <kientzle@gmail.com> | 2009-05-24 19:35:53 -0400 |
---|---|---|
committer | Tim Kientzle <kientzle@gmail.com> | 2009-05-24 19:35:53 -0400 |
commit | b70fcb33e382ef56fe94c0a390688f09be1fca63 (patch) | |
tree | 5f166a4bb2e1d094ddd7acf4ce79976628d94f57 /libarchive/archive_read_open_fd.c | |
parent | 65abade3da1c554bead012e75a7a415b25fc1d8f (diff) | |
download | libarchive-b70fcb33e382ef56fe94c0a390688f09be1fca63.tar.gz |
Be more careful about text/binary mode.
Libarchive is already pretty careful about using O_BINARY
whenever it opens a file handle internally; this extends
that care to file descriptors that are passed in from clients
by invoking _setmode() explicitly.
The test harness was much less careful about O_BINARY;
this adds those flags to all open() calls and modifies
fopen() calls to use "wb" and "rb" explicitly.
In particular, this should remove the need for clients
to use invoke _set_fmode() at all.
This is not yet completely tested...
SVN-Revision: 1103
Diffstat (limited to 'libarchive/archive_read_open_fd.c')
-rw-r--r-- | libarchive/archive_read_open_fd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libarchive/archive_read_open_fd.c b/libarchive/archive_read_open_fd.c index f5be2e5b..ed58c6c4 100644 --- a/libarchive/archive_read_open_fd.c +++ b/libarchive/archive_read_open_fd.c @@ -96,6 +96,10 @@ archive_read_open_fd(struct archive *a, int fd, size_t block_size) } else mine->can_skip = 0; +#if defined(_WIN32_) + _setmode(mine->fd, _O_BINARY); +#endif + return (archive_read_open2(a, mine, NULL, file_read, file_skip, file_close)); } |