[6/8] Avoid shadowing in fdwalk
Commit Message
-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-09-22 Tom Tromey <tom@tromey.com>
* common/filestuff.c (fdwalk): Remove inner declaration of
"result".
---
gdb/ChangeLog | 5 +++++
gdb/common/filestuff.c | 1 -
2 files changed, 5 insertions(+), 1 deletion(-)
Comments
On Sat, 22 Sep 2018 22:08:12 -0600
Tom Tromey <tom@tromey.com> wrote:
> -Wshadow=local caught this buglet. fdwalk redeclares "result" in the
> inner scope, meaning that this function will always return 0, even on
> error.
Wow!
> gdb/ChangeLog
> 2018-09-22 Tom Tromey <tom@tromey.com>
>
> * common/filestuff.c (fdwalk): Remove inner declaration of
> "result".
This is okay.
Kevin
@@ -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);