From patchwork Thu Dec 21 22:59:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 852164 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Fc6xw2Bm"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="Gw/Au6T/"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z2nD66W3pz9ryQ for ; Fri, 22 Dec 2017 10:00:22 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=b1aEeUWHaTeMQfye6/bqTo7vsQOq1vrpbQJY1wb6qLk=; b=Fc6xw2BmgIc6xT fGrGeedHNv6joWIiiQPQ3ZNH3mI2YmzqxjwG0QUQn8BmuUKp6te9YcSniHiLAEovDgU6twa+C5XCV UiT6bOxWeEH5jV5zNGyQkhXTKy943t/H3zkXRlN2kZNee7XShmaleZn/BO7StYbcCeN7lvbbqGVaI ggrNws1EcooXhzRTpI6KS1yusQU7QT8TmLScRi+oGEHEUlrCsoDamJEjIP3i4mHv03+4HiHSM/MuZ oOcPOv6G85/2j+p4/TC7mfPCb9sVu8axOnLwKhOORTwE0o6gXX4uCInhvtpWYC1q/XH0x66sqZQqv BxPYDFaMIRFeW/f9Autw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eS9ot-0005px-A8; Thu, 21 Dec 2017 23:00:07 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::9]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eS9om-0005Vz-3P for lede-dev@lists.infradead.org; Thu, 21 Dec 2017 23:00:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1513897187; s=domk; d=heimpold.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject; bh=/prt5TwoSC20HYQ2T+HSufUqpBESA87kSrhrg0FAvnI=; b=Gw/Au6T/ik1bYR37PUrhB440ckHXpw3FliJtGAcyojP+AQyz8knIXc7XCln0ENeEgG CW68DslP3przQcZ20UI2fsN/cbuHWpZrIhjNS61QZZYEKmF+6HgrNte9Tsxaza7XUZfS Hx3nX8gbTLpenmXJt7cxNtYXQWTEsu1EEmoS0= X-RZG-AUTH: :O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZPUGwIpLOmsCM+BB/Jumg6xgvP7zTEmd6XE5ldAR8t4zBTaiOPbzqatzKSbW9t+O5KA== X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr (p200300C7CBD4A700505400FFFEE949E7.dip0.t-ipconnect.de [IPv6:2003:c7:cbd4:a700:5054:ff:fee9:49e7]) by smtp.strato.de (RZmta 42.14 AUTH) with ESMTPSA id Y00a23tBLMxlSWU (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 21 Dec 2017 23:59:47 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id 977371CC11D; Thu, 21 Dec 2017 23:59:46 +0100 (CET) From: Michael Heimpold To: lede-dev@lists.infradead.org Date: Thu, 21 Dec 2017 23:59:32 +0100 Message-Id: <1513897174-20803-6-git-send-email-mhei@heimpold.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513897174-20803-1-git-send-email-mhei@heimpold.de> References: <1513897174-20803-1-git-send-email-mhei@heimpold.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171221_150000_616533_D6A434CF X-CRM114-Status: UNSURE ( 7.41 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5300:0:0:9 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [LEDE-DEV] [PATCH 5/7] firmware-tools/ptgen: improve error messages on failures X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Michael Heimpold --- tools/firmware-utils/src/ptgen.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/firmware-utils/src/ptgen.c b/tools/firmware-utils/src/ptgen.c index af14d73..3e1b8ba 100644 --- a/tools/firmware-utils/src/ptgen.c +++ b/tools/firmware-utils/src/ptgen.c @@ -30,6 +30,7 @@ #include #include #include +#include #if __BYTE_ORDER == __BIG_ENDIAN #define cpu_to_le32(x) bswap_32(x) @@ -168,24 +169,24 @@ static int gen_ptable(uint32_t signature, int nr) } if ((fd = open(filename, O_WRONLY|O_CREAT, 0644)) < 0) { - fprintf(stderr, "Can't open output file '%s'\n",filename); + fprintf(stderr, "Can't open output file '%s': %s\n", filename, strerror(errno)); return -1; } lseek(fd, 440, SEEK_SET); if (write(fd, &signature, sizeof(signature)) != sizeof(signature)) { - fprintf(stderr, "write failed.\n"); + perror("Writing disk signature failed"); goto fail; } lseek(fd, 446, SEEK_SET); if (write(fd, pte, sizeof(struct pte) * 4) != sizeof(struct pte) * 4) { - fprintf(stderr, "write failed.\n"); + perror("Writing partition table failed"); goto fail; } lseek(fd, 510, SEEK_SET); if (write(fd, "\x55\xaa", 2) != 2) { - fprintf(stderr, "write failed.\n"); + perror("Writing signature failed"); goto fail; }