This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 6/8] 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-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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]