diff options
Diffstat (limited to 'scripts/dtc/fstree.c')
-rw-r--r-- | scripts/dtc/fstree.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c index e464727c8808..6d1beec9581d 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)); } + |