aboutsummaryrefslogtreecommitdiff
path: root/fstree.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-02-01 16:41:59 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2014-02-01 16:48:19 +1100
commit24cb3d0681d9196d57176a0a94bfc6e610ef7b45 (patch)
tree9632917fb8fc895aa554d7b9a4eeeb5f221aa36f /fstree.c
parentc231d94e0f620bc25c76415e09f7dea939064bd8 (diff)
downloaddtc-24cb3d0681d9196d57176a0a94bfc6e610ef7b45.zip
dtc-24cb3d0681d9196d57176a0a94bfc6e610ef7b45.tar.gz
dtc-24cb3d0681d9196d57176a0a94bfc6e610ef7b45.tar.bz2
dtc: fix some more -Wshadow warnings
Building on a RHEL6 system produced the following -Wshadow warnings in fstree.c, util.c and checks.c: cc1: warnings being treated as errors checks.c: In function 'parse_checks_option': checks.c:709: error: declaration of 'optarg' shadows a global declaration /usr/include/getopt.h:59: error: shadowed declaration is here make[1]: *** [checks.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: *** Waiting for unfinished jobs.... cc1: warnings being treated as errors fstree.c: In function 'read_fstree': fstree.c:40: error: declaration of 'tmpnam' shadows a global declaration /usr/include/stdio.h:208: error: shadowed declaration is here make[1]: *** [fstree.o] Error 1 cc1: warnings being treated as errors util.c: In function 'xstrdup': util.c:42: error: declaration of 'dup' shadows a global declaration /usr/include/unistd.h:528: error: shadowed declaration is here Fix all of these -Wshadow warnings by using slightly different variable names which won't collide with anything else. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Diffstat (limited to 'fstree.c')
-rw-r--r--fstree.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fstree.c b/fstree.c
index f377453..4d2791c 100644
--- a/fstree.c
+++ b/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, "r");
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);