From 96be772d647e59d7b83c5bbc6a78b720b570bb8c Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Fri, 12 Dec 2014 21:45:33 -0800 Subject: [PATCH] Use binary mode when opening files. --- contrib/untar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 { -- 2.47.2