From b8c888478d517a39d8b0104857d573e47620a3d1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 22 Apr 2018 10:11:32 -0600 Subject: [PATCH] Avoid shadowing in fdwalk -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 * common/filestuff.c (fdwalk): Remove inner declaration of "result". --- gdb/ChangeLog | 5 +++++ gdb/common/filestuff.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9a8390b7087..42c55edf4c8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-10-04 Tom Tromey + + * common/filestuff.c (fdwalk): Remove inner declaration of + "result". + 2018-10-04 Tom Tromey * msp430-tdep.c (msp430_push_dummy_call): Rename inner diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c index fa10165a7ca..dfd86f9fbbd 100644 --- a/gdb/common/filestuff.c +++ b/gdb/common/filestuff.c @@ -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); -- 2.30.2