diff options
author | Tim Kientzle <kientzle@acm.org> | 2014-12-12 21:45:33 -0800 |
---|---|---|
committer | Tim Kientzle <kientzle@acm.org> | 2014-12-12 21:45:33 -0800 |
commit | 96be772d647e59d7b83c5bbc6a78b720b570bb8c (patch) | |
tree | 36c131e2be3cf052c97da34a1a27814dd935d7fe /contrib | |
parent | 6df4401382c237d384eca8ac1ec2ecf9c4bc81b8 (diff) | |
download | libarchive-96be772d647e59d7b83c5bbc6a78b720b570bb8c.tar.gz |
Use binary mode when opening files.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/untar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/untar.c b/contrib/untar.c index c3abf527..3d954f63 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 { |