diff options
| author | Martin Matuska <mm@FreeBSD.org> | 2016-05-11 10:19:44 +0000 |
|---|---|---|
| committer | Martin Matuska <mm@FreeBSD.org> | 2016-05-11 10:19:44 +0000 |
| commit | 4e579f6c9425c995106fbf72667f4ec7e5d5db85 (patch) | |
| tree | d298bb9fa3cf4f58e328e696a77fadf758a534eb /contrib/untar.c | |
| parent | 8c8f03ca5b7f1f0d07c23e7c354a45b7c95335f0 (diff) | |
Diffstat (limited to 'contrib/untar.c')
| -rw-r--r-- | contrib/untar.c | 10 |
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 { |
