From: Greg Ungerer Date: Mon, 3 Apr 2006 00:24:56 +0000 (+0000) Subject: Changed the mode argument for all the popen() calls to be just "w", X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3901905f37d1ceb394009b0571d920997c28b66d;p=elf2flt.git Changed the mode argument for all the popen() calls to be just "w", 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. --- diff --git a/flthdr.c b/flthdr.c index fc83780..9bb0358 100644 --- 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; }