mirror of https://gitlab.com/qemu-project/dtc.git
Open binary files in binary mode
The "b" flag to fopen() is generally a no-op on Unix-like systems, but may be important on other systems, including Windows. Signed-off-by: Andrei Errapart <andrei@errapartengineering.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
25a9bd6267
commit
83e606a64d
2
dtc.c
2
dtc.c
|
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
|
||||||
if (streq(outname, "-")) {
|
if (streq(outname, "-")) {
|
||||||
outf = stdout;
|
outf = stdout;
|
||||||
} else {
|
} else {
|
||||||
outf = fopen(outname, "w");
|
outf = fopen(outname, "wb");
|
||||||
if (! outf)
|
if (! outf)
|
||||||
die("Couldn't open output file %s: %s\n",
|
die("Couldn't open output file %s: %s\n",
|
||||||
outname, strerror(errno));
|
outname, strerror(errno));
|
||||||
|
|
2
fstree.c
2
fstree.c
|
@ -52,7 +52,7 @@ static struct node *read_fstree(const char *dirname)
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
FILE *pfile;
|
FILE *pfile;
|
||||||
|
|
||||||
pfile = fopen(tmpname, "r");
|
pfile = fopen(tmpname, "rb");
|
||||||
if (! pfile) {
|
if (! pfile) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"WARNING: Cannot open %s: %s\n",
|
"WARNING: Cannot open %s: %s\n",
|
||||||
|
|
2
srcpos.c
2
srcpos.c
|
@ -77,7 +77,7 @@ static char *try_open(const char *dirname, const char *fname, FILE **fp)
|
||||||
else
|
else
|
||||||
fullname = join_path(dirname, fname);
|
fullname = join_path(dirname, fname);
|
||||||
|
|
||||||
*fp = fopen(fullname, "r");
|
*fp = fopen(fullname, "rb");
|
||||||
if (!*fp) {
|
if (!*fp) {
|
||||||
free(fullname);
|
free(fullname);
|
||||||
fullname = NULL;
|
fullname = NULL;
|
||||||
|
|
Loading…
Reference in New Issue