From: Tim Kientzle Date: Sat, 13 Dec 2014 05:45:33 +0000 (-0800) Subject: Use binary mode when opening files. X-Git-Tag: v3.1.900a~166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96be772d647e59d7b83c5bbc6a78b720b570bb8c;p=thirdparty%2Flibarchive.git Use binary mode when opening files. --- diff --git a/contrib/untar.c b/contrib/untar.c index c3abf5276..3d954f638 100644 --- a/contrib/untar.c +++ b/contrib/untar.c @@ -99,7 +99,7 @@ static FILE * create_file(char *pathname, int mode) { FILE *f; - f = fopen(pathname, "w+"); + f = fopen(pathname, "wb+"); if (f == NULL) { /* Try creating parent dir and then creating file. */ char *p = strrchr(pathname, '/'); @@ -107,7 +107,7 @@ create_file(char *pathname, int mode) *p = '\0'; create_dir(pathname, 0755); *p = '/'; - f = fopen(pathname, "w+"); + f = fopen(pathname, "wb+"); } } return (f); @@ -217,7 +217,7 @@ main(int argc, char **argv) ++argv; /* Skip program name */ for ( ;*argv != NULL; ++argv) { - a = fopen(*argv, "r"); + a = fopen(*argv, "rb"); if (a == NULL) fprintf(stderr, "Unable to open %s\n", *argv); else {