Avoid shadowing in fdwalk
authorTom Tromey <tom@tromey.com>
Sun, 22 Apr 2018 16:11:32 +0000 (10:11 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 5 Oct 2018 04:51:48 +0000 (22:51 -0600)
-Wshadow=local caught this buglet.  fdwalk redeclares "result" in the
inner scope, meaning that this function will always return 0, even on
error.

gdb/ChangeLog
2018-10-04  Tom Tromey  <tom@tromey.com>

* common/filestuff.c (fdwalk): Remove inner declaration of
"result".

gdb/ChangeLog
gdb/common/filestuff.c

index 9a8390b..42c55ed 100644 (file)
@@ -1,5 +1,10 @@
 2018-10-04  Tom Tromey  <tom@tromey.com>
 
+       * common/filestuff.c (fdwalk): Remove inner declaration of
+       "result".
+
+2018-10-04  Tom Tromey  <tom@tromey.com>
+
        * msp430-tdep.c (msp430_push_dummy_call): Rename inner
        "structs_addr" and hoist declaration.
 
index fa10165..dfd86f9 100644 (file)
@@ -80,7 +80,6 @@ fdwalk (int (*func) (void *, int), void *arg)
        {
          long fd;
          char *tail;
-         int result;
 
          errno = 0;
          fd = strtol (entry->d_name, &tail, 10);