This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Avoid shadowing in fdwalk
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 5 Oct 2018 04:58:48 -0000
- Subject: [binutils-gdb] Avoid shadowing in fdwalk
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b8c888478d517a39d8b0104857d573e47620a3d1
commit b8c888478d517a39d8b0104857d573e47620a3d1
Author: Tom Tromey <tom@tromey.com>
Date: Sun Apr 22 10:11:32 2018 -0600
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 <tom@tromey.com>
* common/filestuff.c (fdwalk): Remove inner declaration of
"result".
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/common/filestuff.c | 1 -
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9a8390b..42c55ed 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index fa10165..dfd86f9 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);