From patchwork Fri Oct 28 08:37:50 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: 9401547 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 AF25760588 for ; Fri, 28 Oct 2016 08:38:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1CB02A652 for ; Fri, 28 Oct 2016 08:38:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 963B22A655; Fri, 28 Oct 2016 08:38:31 +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 4572C2A652 for ; Fri, 28 Oct 2016 08:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759373AbcJ1Iia (ORCPT ); Fri, 28 Oct 2016 04:38:30 -0400 Received: from mout.web.de ([212.227.15.3]:55145 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759380AbcJ1Ii1 (ORCPT ); Fri, 28 Oct 2016 04:38:27 -0400 Received: from [192.168.1.2] ([77.182.172.137]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0MXpmp-1cMQkC1TXD-00WljO; Fri, 28 Oct 2016 10:37:51 +0200 Subject: [PATCH 07/10] scripts/basic/fixdep: Fix error log output in do_config_file() 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: <38828145-ab16-0eda-0f8c-6a9f27cd17bd@users.sourceforge.net> Date: Fri, 28 Oct 2016 10:37:50 +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:YNTRbn5yn3fO7w4b+ufr9cgbuNOUNHugXFCw/TXICwD1IqJw6AY xXUGOLYCnI/maSVxPUjDvhsUc9fASIzJYW9GHjvO++iMIT6ruMnnT8mYRtNqyNWSIoMa8Cp lUAKZovn9ZBcN/ijmcxESc4NhmeE1XrtXOQRtTr16w2PeXel6pdBbrDT2E1EilB22FANuzk aCYOlurDkdZgaC7fYDTFg== X-UI-Out-Filterresults: notjunk:1; V01:K0:M0JCL8ZAne0=:xGlgPwN+EUOKYjU+orQfIA eMRWHIx5j018GV9QJobM3zFOdbi+NcTMEkwNZD10gyOCMbvcqZOjRlWLjUgCzI6EdLHS+0OV3 PbWqilR9pKUKQQ2zknC3J9EwvKuuXT0AfnW1UDWK33Ecq9V/ov4xrD080S+eIbf+ozbGfnbS8 VVsRZfDVXt+YwWEbBZlDIwHoH3O9zgP3grqbRfSBhajLzunKU/Unvl5jHSRWq/UChWNe0MOsH WC+nZEBNT430AR61491tY+yNnlUEsGHMudFUJepJ6AEc/AkCt5x3bW/LFESkxQ9lfLMmPKs8K NZUXHbPtMeriKPVg3XzcHTUCzLE6cC/lVJWuvZQWo4628YUqvU1LH1+uS9DtM9ygtGCByN1Xv Mveaj/xA4uz0Ch86d3j+wST6JCVy8aRsgKJuUpmpYBOqvL5tYJkGFGnx+uJjtbZtp4X+Lv9WZ 0gYDiaT0YHMTYTUrBZ/KBKkZLez3luCHYkpOAOVdi7A+5m3ruIV4lGbDsV4WKsyeKLlVv1c86 D3/RUu0iWuX/BrY7cwyMmesXimQ4TX4q3JO1inx/uanrroVX7tw0R/TGrpylecyPFndR+BP5D JkwG2FcvMeTfulVFMmz7hRMtFIjKwYvEpI0XzttmOdlpO5JQ4qCBrb0P0rckq0DB7SoeBFMtM R+aZexD81MY5NLRsFLy+xvGql+iKAIHrd5LpyQOm4FHAHk78Q33rtycujWBeQKK6JjOpHWKYz ZeUWQ/zeUhosQoDoEOJPG/KlykvR688hbQmuPqBca9FgxThKvEAkt+vxiOJM5Vg+6iEFU3x3R 0QbvQhl 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 22:15:14 +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 be0fdaa..2c4ec91 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -275,13 +275,15 @@ static void do_config_file(const char *filename) fd = open(filename, O_RDONLY); if (fd < 0) { - fprintf(stderr, "fixdep: error opening config file: "); - perror(filename); + (void) fprintf(stderr, + "fixdep: error opening config file: %s: %s\n", + filename, strerror(errno)); exit(2); } if (fstat(fd, &st) < 0) { - fprintf(stderr, "fixdep: error fstat'ing config file: "); - perror(filename); + (void) fprintf(stderr, + "fixdep: error fstat'ing config file: %s: %s\n", + filename, strerror(errno)); exit(2); } if (st.st_size == 0)