[Crosstoolchain-logs] [device-tree-compiler] 237/357: Handle absolute pathnames correctly in dtc_open_file.

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


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

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

commit 5695e99d5f6418f8f5b990bdcb1f153935d0fb06
Author: Scott Wood <scottwood at freescale.com>
Date:   Fri Jan 4 15:10:45 2008 -0600

    Handle absolute pathnames correctly in dtc_open_file.
    
    Also, free file->dir when freeing file.
    
    Signed-off-by: Scott Wood <scottwood at freescale.com>
---
 srcpos.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/srcpos.c b/srcpos.c
index 7340c33..7a0c47e 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -86,6 +86,16 @@ struct dtc_file *dtc_open_file(const char *fname,
 		return file;
 	}
 
+	if (fname[0] == '/') {
+		file->file = fopen(fname, "r");
+
+		if (!file->file)
+			goto out;
+
+		file->name = strdup(fname);
+		return file;
+	}
+
 	if (!search)
 		search = &default_search;
 
@@ -100,6 +110,7 @@ struct dtc_file *dtc_open_file(const char *fname,
 	}
 
 out:
+	free((void *)file->dir);
 	free(file);
 	return NULL;
 }
@@ -109,5 +120,6 @@ void dtc_close_file(struct dtc_file *file)
 	if (fclose(file->file))
 		die("Error closing \"%s\": %s\n", file->name, strerror(errno));
 
+	free((void *)file->dir);
 	free(file);
 }

-- 
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