From patchwork Fri Oct 28 08:34:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9401525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5F36B60588 for ; Fri, 28 Oct 2016 08:34:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DB122A5A5 for ; Fri, 28 Oct 2016 08:34:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ED762A63B; Fri, 28 Oct 2016 08:34:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2C302A5A5 for ; Fri, 28 Oct 2016 08:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964782AbcJ1Iei (ORCPT ); Fri, 28 Oct 2016 04:34:38 -0400 Received: from mout.web.de ([212.227.15.4]:60411 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964792AbcJ1Ieg (ORCPT ); Fri, 28 Oct 2016 04:34:36 -0400 Received: from [192.168.1.2] ([77.182.172.137]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0MduaT-1cGKym0J8X-00PZe6; Fri, 28 Oct 2016 10:34:29 +0200 Subject: [PATCH 04/10] scripts/basic/fixdep: Fix error log output in print_deps() To: linux-kbuild@vger.kernel.org, Michal Marek References: <72e07814-56e9-505a-d660-91ff20b6efea@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Fri, 28 Oct 2016 10:34:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <72e07814-56e9-505a-d660-91ff20b6efea@users.sourceforge.net> X-Provags-ID: V03:K0:73nY4ZzfvcEF6KUx09yAo9rZXIs14Wc65TSYwmNMao4qRf8DPKA XYKZOMgNCQe0xuKSbTyBuHclIybK6dooBxAto+4RtE3/0UlbSbBE1KaX6o4O1Y7pd/EUdx3 5DJEg2/n4AIbILxCNJzWq3e6xq+xtgz+XjmWCRPWEhpkvK7mSfv/OhJN62V7bXI2doL2jnr EHIhCq989LCM6FHy66opA== X-UI-Out-Filterresults: notjunk:1; V01:K0:dee1yJxEcgU=:KV9tWrh037j+EaXrJ/sx5S MXSfFR70jH6wDHA4upLsh4f4TUgD9y719nH8HOIFFDPvM6PnlrYDAHfP1uRtFYH1jJfioJsCo aTbsNBacamdJGkovvUbIgcMLroXxHvMhY6W56YC+HI0rwibmfXwRizxIn+3aIV2cCkjtwjI1j 5SgJekQP1+LzAaeXYHS+garH9cYy4FzjVsaNdmS8jmNVXW8iCYDiYo9sVrSvXnZddf0jvfKx7 SPGiDQX2crr15ffcImCy+8NMSH/j1iygCMrm43WhF8jPqzQTZTs3bWsvLJ+cTQ5CUVFLB57+X nHpzb0/OVDlR0drPDZBAp0DeWsBG2mzUe1v5LdNlDo00f7C5NfQ02drMPqBk+V8l4C9S7b2hK VSvI6GMvWdFhk2lfdmabicjRMR8K64XRy6PHQRG4ss0djXZUjfB4yyMHVW7yR5gdiJbi4jXXk DQmAgkg6piuAFdXg+CzBy3kNmTa5vAMFF+7hlFb2xr/b/hHg5yh6kNiWLz6mzVFTs5lH0yIAd srOFFjtREsguVAT8uBXpUqmOFCePvC2SdiViqVigjrUGjlY46/87R2gzX3AIYCgl5PUN06O7/ Wi7ZpSN4wJ0DdvHP7AAjYTZsuFmzXJ7gZW4xQKeb9bMeYV7CEgY99nSsEGXC5YxCxF6dgz+j7 caJ8o00VqZDVk/GuyCea9ArecYOv+Uf/vMPszJUq91ydwK3qxZxIs68YgEg27WrEvipbXvI9z Q84vFSTfFr/28/Ysivw315eqZtkq+u/3nSZXdFaQShBJ0C7R03jN7hMcfK5SdgUWMNuCFgvbB oqHIOjE Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 27 Oct 2016 19:04:01 +0200 The function "perror" was called after a call of the function "fprintf" in two if branches. So it could happen that an error message was displayed for a failed print operation instead of the failure according to the call of the function "fstat" or "open" here. * Pass the relevant error data in the logging calls directly. * Express that the corresponding return values are intentionally unused by casts to void. Signed-off-by: Markus Elfring --- scripts/basic/fixdep.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 0dcec29..9a2ff68 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -403,13 +403,15 @@ static void print_deps(void) fd = open(depfile, O_RDONLY); if (fd < 0) { - fprintf(stderr, "fixdep: error opening depfile: "); - perror(depfile); + (void) fprintf(stderr, + "fixdep: error opening depfile: %s: %s\n", + depfile, strerror(errno)); exit(2); } if (fstat(fd, &st) < 0) { - fprintf(stderr, "fixdep: error fstat'ing depfile: "); - perror(depfile); + (void) fprintf(stderr, + "fixdep: error fstat'ing depfile: %s: %s\n", + depfile, strerror(errno)); exit(2); } if (st.st_size == 0) {