This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 6/8] Avoid shadowing in fdwalk
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Sat, 22 Sep 2018 22:08:12 -0600
- Subject: [PATCH 6/8] Avoid shadowing in fdwalk
- References: <20180923040814.27941-1-tom@tromey.com>
-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(-)
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index fa10165a7c..dfd86f9fbb 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.17.1