OSDN Git Service

Changed the mode argument for all the popen() calls to be just "w",
authorGreg Ungerer <gerg@snapgear.com>
Mon, 3 Apr 2006 00:24:56 +0000 (00:24 +0000)
committerGreg Ungerer <gerg@snapgear.com>
Mon, 3 Apr 2006 00:24:56 +0000 (00:24 +0000)
instead of "wb". According to the Linux manual page posix implementations
must accept only "r" or "w", no other characters. And you will get a
return error with EINVAL with modern version og glibc if this is not
the case.

It may well be that this is fine for CYGWIN too, someone needs to
test and report.

Calls to fopen and the like are unchanged, and they certainly do
support the "b" mode specifier.

flthdr.c

index fc83780..9bb0358 100644 (file)
--- a/flthdr.c
+++ b/flthdr.c
@@ -242,7 +242,7 @@ process_file(char *ifile, char *ofile)
                }
 
                sprintf(cmd, "gunzip >> %s", tfile2);
-               tfp = popen(cmd, "wb");
+               tfp = popen(cmd, "w");
                if(!tfp) {
                        perror("popen");
                        exit(1);
@@ -264,7 +264,7 @@ process_file(char *ifile, char *ofile)
                printf("zflat %s --> %s\n", ifile, ofile);
                fclose(ofp);
                sprintf(cmd, "gzip -9 -f >> %s", tfile);
-               ofp = popen(cmd, "wb");
+               ofp = popen(cmd, "w");
                ofp_is_pipe = 1;
        } else if (new_flags & FLAT_FLAG_GZDATA) {
                printf("zflat-data %s --> %s\n", ifile, ofile);
@@ -272,7 +272,7 @@ process_file(char *ifile, char *ofile)
                                sizeof(struct flat_hdr));
                fclose(ofp);
                sprintf(cmd, "gzip -9 -f >> %s", tfile);
-               ofp = popen(cmd, "wb");
+               ofp = popen(cmd, "w");
                ofp_is_pipe = 1;
        }