[Crosstoolchain-logs] [device-tree-compiler] 136/198: Open binary files in binary mode

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:07:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.4.x
in repository device-tree-compiler.

commit 83e606a64d7b555bea3c3007b48bb9f790f0139c
Author: Andrei Errapart <andrei at errapartengineering.com>
Date:   Thu Jun 19 21:12:27 2014 +1000

    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 at errapartengineering.com>
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 dtc.c    | 2 +-
 fstree.c | 2 +-
 srcpos.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dtc.c b/dtc.c
index d36ccdc..e3665b6 100644
--- a/dtc.c
+++ b/dtc.c
@@ -237,7 +237,7 @@ int main(int argc, char *argv[])
 	if (streq(outname, "-")) {
 		outf = stdout;
 	} else {
-		outf = fopen(outname, "w");
+		outf = fopen(outname, "wb");
 		if (! outf)
 			die("Couldn't open output file %s: %s\n",
 			    outname, strerror(errno));
diff --git a/fstree.c b/fstree.c
index 4d2791c..6d1beec 100644
--- a/fstree.c
+++ b/fstree.c
@@ -52,7 +52,7 @@ static struct node *read_fstree(const char *dirname)
 			struct property *prop;
 			FILE *pfile;
 
-			pfile = fopen(tmpname, "r");
+			pfile = fopen(tmpname, "rb");
 			if (! pfile) {
 				fprintf(stderr,
 					"WARNING: Cannot open %s: %s\n",
diff --git a/srcpos.c b/srcpos.c
index 4549773..f534c22 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -77,7 +77,7 @@ static char *try_open(const char *dirname, const char *fname, FILE **fp)
 	else
 		fullname = join_path(dirname, fname);
 
-	*fp = fopen(fullname, "r");
+	*fp = fopen(fullname, "rb");
 	if (!*fp) {
 		free(fullname);
 		fullname = NULL;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list