From aa263f13f3238ce3b0023daad8194df4a513816e Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 13 Nov 2013 10:06:47 +0000 Subject: [PATCH] Open files in binary mode on systems that have O_BINARY There are three places in the library where files are opened. In two of those places the flag O_BINARY is included if defined. This patch does the same in the third. I noticed this because I've been using (a hacked version of) the library cross-compiled with MinGW on WIN32. I expect Cygwin would also be affected. Ron --- lib/append.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/append.c b/lib/append.c index ff58532..32622f3 100644 --- a/lib/append.c +++ b/lib/append.c @@ -218,7 +218,11 @@ tar_append_regfile(TAR *t, const char *realname) size_t size; int rv = -1; +#if defined(O_BINARY) + filefd = open(realname, O_RDONLY|O_BINARY); +#else filefd = open(realname, O_RDONLY); +#endif if (filefd == -1) { #ifdef DEBUG -- 2.11.4.GIT