From patchwork Sun Sep 23 04:08:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 29507 Received: (qmail 84566 invoked by alias); 23 Sep 2018 04:08:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 84077 invoked by uid 89); 23 Sep 2018 04:08:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*RU:sk:gateway, Hx-spam-relays-external:sk:gateway X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Sep 2018 04:08:20 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 88BD62D516 for ; Sat, 22 Sep 2018 23:08:19 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 3vgxgYlHMRPoj3vgxguCHS; Sat, 22 Sep 2018 23:08:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=yfJW5s41SudRXNg52oQa/wKacaIqvGZEwB4T2DJ3dco=; b=i2rG1229bZK8J9aMXs6eUIM8CJ kb3qV/veKaBAYTuS3H6rXWZaZWqckA0ewyWSZqZbVEj0f/RCc71wlBgWPg3JBrP57tcB/hUHXz5gY m+/8aJeXnYi6uN3MuaLTq0lla; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:37440 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1g3vgx-002UJa-Ae; Sat, 22 Sep 2018 23:08:19 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 6/8] Avoid shadowing in fdwalk Date: Sat, 22 Sep 2018 22:08:12 -0600 Message-Id: <20180923040814.27941-7-tom@tromey.com> In-Reply-To: <20180923040814.27941-1-tom@tromey.com> 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 * 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);