summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c')
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
index e6ac99f6bfb..7db6db3377a 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_mtree.c,v 1.2 2008/02/19 06:07:10 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -50,6 +50,10 @@ __FBSDID("$FreeBSD$");
#include "archive_read_private.h"
#include "archive_string.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
struct mtree_entry {
struct mtree_entry *next;
char *name;
@@ -371,7 +375,8 @@ read_header(struct archive_read *a, struct archive_entry *entry)
* the contents file on disk.)
*/
if (archive_strlen(&mtree->contents_name) > 0) {
- mtree->fd = open(mtree->contents_name.s, O_RDONLY);
+ mtree->fd = open(mtree->contents_name.s,
+ O_RDONLY | O_BINARY);
if (mtree->fd < 0) {
archive_set_error(&a->archive, errno,
"Can't open content=\"%s\"",
@@ -380,7 +385,8 @@ read_header(struct archive_read *a, struct archive_entry *entry)
}
} else {
/* If the specified path opens, use it. */
- mtree->fd = open(mtree->current_dir.s, O_RDONLY);
+ mtree->fd = open(mtree->current_dir.s,
+ O_RDONLY | O_BINARY);
/* But don't fail if it's not there. */
}