summaryrefslogtreecommitdiff
path: root/contrib/untar.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/untar.c')
-rw-r--r--contrib/untar.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/untar.c b/contrib/untar.c
index c4cc2bf9bea2c..3d954f638be02 100644
--- a/contrib/untar.c
+++ b/contrib/untar.c
@@ -1,4 +1,8 @@
/*
+ * This file is in the public domain. Use it as you see fit.
+ */
+
+/*
* "untar" is an extremely simple tar extractor:
* * A single C source file, so it should be easy to compile
* and run on any system with a C compiler.
@@ -95,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, '/');
@@ -103,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);
@@ -213,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 {