]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
On Windows, set _O_BINARY on filehandles passed in from clients.
authorTim Kientzle <kientzle@gmail.com>
Sat, 27 Jun 2009 03:48:20 +0000 (23:48 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sat, 27 Jun 2009 03:48:20 +0000 (23:48 -0400)
This should eliminate the need for clients to take special
measures to get correct binary handling.

SVN-Revision: 1187

libarchive/archive_read_open_fd.c
libarchive/archive_read_open_file.c
libarchive/archive_read_open_filename.c
libarchive/archive_write_open_fd.c

index ed58c6c48e2eb7f2a99b975c54007ea6a178a7c8..03a6bf622027609e5df0fa28fa53a72d3d2dcf8b 100644 (file)
@@ -96,7 +96,7 @@ archive_read_open_fd(struct archive *a, int fd, size_t block_size)
        } else
                mine->can_skip = 0;
 
-#if defined(_WIN32_)
+#if defined(_WIN32)
        _setmode(mine->fd, _O_BINARY);
 #endif
 
index 5e78bfe4dbb5da301700259a9c48d71299313580..d1fb821fa91459ecd5048444776045cb9f8090d9 100644 (file)
@@ -94,7 +94,7 @@ archive_read_open_FILE(struct archive *a, FILE *f)
        } else
                mine->can_skip = 0;
 
-#if defined(_WIN32_)
+#if defined(_WIN32)
        _setmode(_fileno(mine->f), _O_BINARY);
 #endif
 
index 2651323eb50838527d13626b25825daf126bfa75..e1adf8182d2664ff575332a1bd0f438b019ce0af 100644 (file)
@@ -96,7 +96,7 @@ archive_read_open_filename(struct archive *a, const char *filename,
                 */
                filename = ""; /* Normalize NULL to "" */
                fd = 0;
-#if defined(_WIN32_)
+#if defined(_WIN32)
                _setmode(0, _O_BINARY);
 #endif
        } else {
index 35e258c4cc236d3e55540bf13485e5bd3e799cbe..b48e00e2e83b8092aabe81f895a02e7cba2b2e76 100644 (file)
@@ -64,6 +64,9 @@ archive_write_open_fd(struct archive *a, int fd)
                return (ARCHIVE_FATAL);
        }
        mine->fd = fd;
+#if defined(_WIN32)
+       _setmode(mine->fd, _O_BINARY);
+#endif
        return (archive_write_open(a, mine,
                    file_open, file_write, file_close));
 }