From c30f3e75ac46b527e64be713c8d73c61f90bcf28 Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Thu, 1 Mar 2018 18:12:44 +0100 Subject: [PATCH] use fopen('wb') for output files / patch from TexLive TLpatches/patch-01-binary --- bins/unzip-mem.c | 2 +- bins/unzzipcat-big.c | 6 +++--- bins/unzzipcat-mem.c | 4 ++-- bins/unzzipcat-mix.c | 6 +++--- bins/unzzipcat-zip.c | 4 ++-- bins/unzzipdir-big.c | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bins/unzip-mem.c b/bins/unzip-mem.c index bf10495..b20bf37 100644 --- a/bins/unzip-mem.c +++ b/bins/unzip-mem.c @@ -96,7 +96,7 @@ static void zzip_mem_entry_pipe(ZZIP_MEM_DISK* disk, static void zzip_mem_entry_make(ZZIP_MEM_DISK* disk, ZZIP_MEM_ENTRY* entry) { - FILE* file = fopen (entry->zz_name, "w"); + FILE* file = fopen (entry->zz_name, "wb"); if (file) { zzip_mem_entry_pipe (disk, entry, file); fclose (file); } perror (entry->zz_name); if (status < EXIT_WARNINGS) status = EXIT_WARNINGS; diff --git a/bins/unzzipcat-big.c b/bins/unzzipcat-big.c index 0efd878..7ab6bad 100644 --- a/bins/unzzipcat-big.c +++ b/bins/unzzipcat-big.c @@ -89,7 +89,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) int argn; FILE* disk; - disk = fopen (argv[1], "r"); + disk = fopen (argv[1], "rb"); if (! disk) { perror(argv[1]); return exitcode(errno); @@ -106,7 +106,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) done = EXIT_WARNINGS; continue; } - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { if (errno != EISDIR) done = EXIT_ERRORS; continue; @@ -139,7 +139,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { if (errno != EISDIR) done = EXIT_ERRORS; continue; diff --git a/bins/unzzipcat-mem.c b/bins/unzzipcat-mem.c index b81c703..13cca3a 100644 --- a/bins/unzzipcat-mem.c +++ b/bins/unzzipcat-mem.c @@ -114,7 +114,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) { char* name = zzip_mem_entry_to_name (entry); FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { if (errno != EISDIR) done = EXIT_ERRORS; continue; @@ -146,7 +146,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { if (errno != EISDIR) done = EXIT_ERRORS; continue; diff --git a/bins/unzzipcat-mix.c b/bins/unzzipcat-mix.c index 1a6cd4c..aa9b86c 100644 --- a/bins/unzzipcat-mix.c +++ b/bins/unzzipcat-mix.c @@ -56,7 +56,7 @@ static int exitcode(int e) static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { - ZZIP_FILE* file = zzip_fopen(name, "r"); + ZZIP_FILE* file = zzip_fopen(name, "rb"); if (file) { char buffer[1024]; int len; @@ -124,7 +124,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) { char* name = entry->d_name; FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { if (errno != EISDIR) done = EXIT_ERRORS; continue; @@ -155,7 +155,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) memcpy(mix_name, zip_name, zip_name_len); mix_name[zip_name_len] = '/'; strcpy(mix_name + zip_name_len + 1, name); - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { if (errno != EISDIR) done = EXIT_ERRORS; continue; diff --git a/bins/unzzipcat-zip.c b/bins/unzzipcat-zip.c index d3644cb..216be41 100644 --- a/bins/unzzipcat-zip.c +++ b/bins/unzzipcat-zip.c @@ -124,7 +124,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) { char* name = entry.d_name; FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { DBG3("fopen' %s : %s", name, strerror(errno)); if (errno != EISDIR) done = EXIT_ERRORS; @@ -146,7 +146,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); if (! out) { DBG3("fopen. %s : %s", name, strerror(errno)); if (errno != EISDIR) done = EXIT_ERRORS; diff --git a/bins/unzzipdir-big.c b/bins/unzzipdir-big.c index 3b7f761..e35648a 100644 --- a/bins/unzzipdir-big.c +++ b/bins/unzzipdir-big.c @@ -35,7 +35,7 @@ unzzip_list (int argc, char ** argv, int verbose) int argn; FILE* disk; - disk = fopen (argv[1], "r"); + disk = fopen (argv[1], "rb"); if (! disk) { perror(argv[1]); return exitcode(errno); -- 2.40.0