diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-01-28 05:32:12 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-01-28 05:32:12 +0000 |
commit | e0b4700acf9b09d502ff0d6c56aa09df352735f4 (patch) | |
tree | 038659dd06cca3f120473b8095f691561749ed0e /toolchain/elf2flt/elf2flt/flthdr.c | |
parent | ee9c02846c2f6f86241053bd11c1e358d4beed52 (diff) | |
download | buildroot-novena-e0b4700acf9b09d502ff0d6c56aa09df352735f4.tar.gz buildroot-novena-e0b4700acf9b09d502ff0d6c56aa09df352735f4.zip |
pull from uClinux CVS
Diffstat (limited to 'toolchain/elf2flt/elf2flt/flthdr.c')
-rw-r--r-- | toolchain/elf2flt/elf2flt/flthdr.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/toolchain/elf2flt/elf2flt/flthdr.c b/toolchain/elf2flt/elf2flt/flthdr.c index fc83780c4..967d64063 100644 --- a/toolchain/elf2flt/elf2flt/flthdr.c +++ b/toolchain/elf2flt/elf2flt/flthdr.c @@ -19,8 +19,10 @@ /* macros for conversion between host and (internet) network byte order */ #ifndef WIN32 #include <netinet/in.h> /* Consts and structs defined by the internet system */ +#define BINARY_FILE_OPTS #else #include <winsock2.h> +#define BINARY_FILE_OPTS "b" #endif /* from uClinux-x.x.x/include/linux */ @@ -83,7 +85,7 @@ process_file(char *ifile, char *ofile) *tfile = *tfile2 = '\0'; - if ((ifp = fopen(ifile, "rb")) == NULL) { + if ((ifp = fopen(ifile, "r" BINARY_FILE_OPTS)) == NULL) { fprintf(stderr, "Cannot open %s\n", ifile); return; } @@ -206,7 +208,7 @@ process_file(char *ifile, char *ofile) strcpy(tfile, "/tmp/flatXXXXXX"); mkstemp(tfile); - if ((ofp = fopen(tfile, "wb")) == NULL) { + if ((ofp = fopen(tfile, "w" BINARY_FILE_OPTS)) == NULL) { fprintf(stderr, "Failed to open %s for writing\n", tfile); unlink(tfile); unlink(tfile2); @@ -231,7 +233,7 @@ process_file(char *ifile, char *ofile) mkstemp(tfile2); if (old_flags & FLAT_FLAG_GZDATA) { - tfp = fopen(tfile2, "wb"); + tfp = fopen(tfile2, "w" BINARY_FILE_OPTS); if (!tfp) { fprintf(stderr, "Failed to open %s for writing\n", tfile2); exit(1); @@ -242,7 +244,7 @@ process_file(char *ifile, char *ofile) } sprintf(cmd, "gunzip >> %s", tfile2); - tfp = popen(cmd, "wb"); + tfp = popen(cmd, "w" BINARY_FILE_OPTS); if(!tfp) { perror("popen"); exit(1); @@ -251,7 +253,7 @@ process_file(char *ifile, char *ofile) pclose(tfp); fclose(ifp); - ifp = fopen(tfile2, "rb"); + ifp = fopen(tfile2, "r" BINARY_FILE_OPTS); if (!ifp) { fprintf(stderr, "Failed to open %s for reading\n", tfile2); unlink(tfile); @@ -264,7 +266,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" BINARY_FILE_OPTS); ofp_is_pipe = 1; } else if (new_flags & FLAT_FLAG_GZDATA) { printf("zflat-data %s --> %s\n", ifile, ofile); @@ -272,7 +274,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" BINARY_FILE_OPTS); ofp_is_pipe = 1; } |