[PATCH 6/8] Avoid shadowing in fdwalk

Tom Tromey tom@tromey.com
Sun Sep 23 04:08:00 GMT 2018


-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



More information about the Gdb-patches mailing list