bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnu-libiconv] genaliases - file open in binary not text mode


From: Mike Fulton
Subject: [bug-gnu-libiconv] genaliases - file open in binary not text mode
Date: Wed, 17 May 2023 10:45:36 -0700

Hi, 

On z/OS, we tag files that are created with the code page they should use
when the file is created in 'text' mode, but we don't do any tagging if the 
files are created in 'binary' mode.

This causes grief in genaliases.c 

I would like to propose a small patch to create these files in text rather than
binary - I don't believe this would create any issues on non-z/OS systems
but I haven't tested there. Here's the proposed patch:

diff --git a/lib/genaliases.c b/lib/genaliases.c
index de7d705..81c7a1c 100644
--- a/lib/genaliases.c
+++ b/lib/genaliases.c
@@ -98,7 +98,7 @@ int main (int argc, char* argv[])
 #define BRACIFY(...) { __VA_ARGS__ }
 #define DEFALIAS(xxx_alias,xxx) emit_alias(aliases_file,xxx_alias,#xxx);

-  canonical_sh_file = fopen(canonical_sh_file_name, "wb");
+  canonical_sh_file = fopen(canonical_sh_file_name, "w");
   if (canonical_sh_file == NULL) {
     fprintf(stderr, "Could not open '%s' for writing\n", canonical_sh_file_name);
     exit(1);
@@ -107,7 +107,7 @@ int main (int argc, char* argv[])
   if (ferror(canonical_sh_file) || fclose(canonical_sh_file))
     exit(1);

-  canonical_sh_file = fopen(canonical_local_sh_file_name, "wb");
+  canonical_sh_file = fopen(canonical_local_sh_file_name, "w");
   if (canonical_sh_file == NULL) {
     fprintf(stderr, "Could not open '%s' for writing\n", canonical_local_sh_file_name);
     exit(1);

Thanks, Mike

reply via email to

[Prev in Thread] Current Thread [Next in Thread]