From 4760597116e34bd58f670d008ae7323653268fb4 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 29 Apr 2015 16:00:05 -0500 Subject: scripts/dtc: Update to upstream version 9d3649bd3be245c9 Sync dtc with upstream as of commit 9d3649bd3be2 (Add testcases for fdt_path_offset_namelen()). Signed-off-by: Rob Herring Cc: Grant Likely Cc: devicetree@vger.kernel.org --- scripts/dtc/fstree.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'scripts/dtc/fstree.c') diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c index e464727c..6d1beec 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c @@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname) tree = build_node(NULL, NULL); while ((de = readdir(d)) != NULL) { - char *tmpnam; + char *tmpname; if (streq(de->d_name, ".") || streq(de->d_name, "..")) continue; - tmpnam = join_path(dirname, de->d_name); + tmpname = join_path(dirname, de->d_name); - if (lstat(tmpnam, &st) < 0) - die("stat(%s): %s\n", tmpnam, strerror(errno)); + if (lstat(tmpname, &st) < 0) + die("stat(%s): %s\n", tmpname, strerror(errno)); if (S_ISREG(st.st_mode)) { struct property *prop; FILE *pfile; - pfile = fopen(tmpnam, "r"); + pfile = fopen(tmpname, "rb"); if (! pfile) { fprintf(stderr, "WARNING: Cannot open %s: %s\n", - tmpnam, strerror(errno)); + tmpname, strerror(errno)); } else { prop = build_property(xstrdup(de->d_name), data_copy_file(pfile, @@ -67,12 +67,12 @@ static struct node *read_fstree(const char *dirname) } else if (S_ISDIR(st.st_mode)) { struct node *newchild; - newchild = read_fstree(tmpnam); + newchild = read_fstree(tmpname); newchild = name_node(newchild, xstrdup(de->d_name)); add_child(tree, newchild); } - free(tmpnam); + free(tmpname); } closedir(d); @@ -88,3 +88,4 @@ struct boot_info *dt_from_fs(const char *dirname) return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); } + -- cgit v1.1