From patchwork Fri Oct 6 09:45:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Bazile X-Patchwork-Id: 822282 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:400e:c05::239; helo=mail-pg0-x239.google.com; envelope-from=swupdate+bncbdrm7hxtxiobbw5b3xhakgqeewlc4vy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="mLAFuNMz"; dkim-atps=neutral Received: from mail-pg0-x239.google.com (mail-pg0-x239.google.com [IPv6:2607:f8b0:400e:c05::239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y7lBl0Vwrz9t3m for ; Fri, 6 Oct 2017 20:46:06 +1100 (AEDT) Received: by mail-pg0-x239.google.com with SMTP id v13sf9236563pgq.11 for ; Fri, 06 Oct 2017 02:46:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1507283164; cv=pass; d=google.com; s=arc-20160816; b=CkO1P8HGarRMhrR12QcHOiBYnO2EH7AUq1LuhOQlfs/+saLPjV7D2ZLKndQFhoaFIU mnB92RGajB1w67Qwz0EkSlpQhqBPTI5ljdhrEwad309oHm874qQh7p4wcZjHliXxOgb3 vWiTS1ADYVe6k1mw0osAy/wIqOrsu++adhV1/ymhYW9MDZLn4uwU6LR9/Px4t6vqw1PC aDaul40h7v8SNXI4Ket8fzHmKTh2B4cw6mZ6z67YMfPUUutOVyZ4aZUtMwc5s83h9mVf mT23jxBb+WFKyw5Z1oW+OCpM1Ikg2DJ58N7mRrBq54qRz+B4ZzgZZsnpsgQEAZlLH0SA /WZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=6ZUasBPyhpSaPTBZ5bEidjcidQ2kirjvuaFmJIq1V84=; b=G+QxhLfpsRWn/1XZBu1yeeyyBTCJNmLics24s/gxTwXzx3abzJnSKmRfSXYPwYBWKi N0a5PCyW9gJZvTUduYXbwr+fPe/N3DfOxgeOlMNU/7xWYA38nlpjao1T/KuC/EG4iLCd hRE5zh33hepBUBKL6wwannNLkt7J4rcE+YjG0XugUEc4BnuAlD1Q6+EsdOCi/i9b+PWg G2cjncfySudxlov4jqh9dwjE6Uo2iwsuOhKmxa9TnKH7lEGwAj8V0kWF9tVHskjd/yHx Xsr7h6s0XyGz8UxUgobfiyDNlCvrIsW45m1C5f+TIbMYSnQ217ydSQdNZfFyQUuyf1AS XwVQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of romain.bazile@ubiant.com designates 188.165.48.182 as permitted sender) smtp.mailfrom=romain.bazile@ubiant.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=6ZUasBPyhpSaPTBZ5bEidjcidQ2kirjvuaFmJIq1V84=; b=mLAFuNMzfM08qHIL5joId60KBcgluJaynGjz2d8wCZDo6OcgHPpX68SHOe8rNT8vwV V2wMRPQJKBXUW7JGB6GaIyZeXP24BM3OoBfvgIFkJhE3V6KzERTOjhcSiTnOO4NNAtv4 4RRVYK+AleKay/UbUTl8+6BejfxaPOBoQJwlEVUOTlkp2a85zva9B58M6XYOHGZiqtat DH6QeI6GxvemluCgJu9LvbKf+pSyAUWvjMUtKj+7ccAb1+Z8kvoq/sXzIcEakTo+DmCJ 05Om5xORUBBW+UJ+jC2M8nSWI9k5E81U1It2iHy/dabet9hfbR8SuhKCaRY8dWdyuYV0 mqtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=6ZUasBPyhpSaPTBZ5bEidjcidQ2kirjvuaFmJIq1V84=; b=d1geJCqa3+i1CKv/9kYQuWwzMqquh5SRoPkKofj0A1UDY3NOG11v4nSo84H7X7xVs4 QgjH0+UfitZsFy2B1wfT+nB44Rfmleqpgdg6v+q5ns8cth22nsvMUGpI8RMIC65n6K1w b/FRL3pb3LG5FRJulSEfvTZHrOWMLO3e0F3+QFd59TdD/mM9kJWJd3yMrJhE/Mg2P71n u2gmsSMFews/0jMCNy1yASMOVQtaKlJ88DgyDpqDKJIvfSE8/AR4X+rceiIrllOXRegr HbKzzbmOOO/+toQIFvEo53z5fd+uadcsgLME4/A+GuSp7HBp4FGsdO1i2oWdZD321q3m MjwQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AMCzsaWDy6qtfMefWzZY+uuaCRgLouwAViCuyTye/K+flnC02nIOnJkx XTwauOlgoWgCl4sbUg9c+PA= X-Google-Smtp-Source: AOwi7QCNMzCeXalhvjL3x4G7PF3MALRETN0xeyz/xMgE+ifMfl0ZJ3pNCZOpG5ZyVW1J3sC0tUqRTw== X-Received: by 10.31.11.69 with SMTP id 66mr64264vkl.6.1507283163979; Fri, 06 Oct 2017 02:46:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.129.146.203 with SMTP id j194ls1444398ywg.1.gmail; Fri, 06 Oct 2017 02:46:03 -0700 (PDT) X-Received: by 10.13.217.204 with SMTP id b195mr1833037ywe.7.1507283163677; Fri, 06 Oct 2017 02:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507283163; cv=none; d=google.com; s=arc-20160816; b=Xzf4EBEZM8ktRojSCtD/CHS73bw7B/2wkU9AC/au9byW538tjy3fOa6I13gMDQ12tE TZm5S6VYhSUqO2vE4y/3tAEFmQSBmtIcfdOjbk8jnSfU02z/Cy37PRaQGm7LE75DU+eu FX+tlQ7Pgogmb3wEfMX6ZCgpr1XIlFij6Mx8hdEoMs8NYt+5d+8ABsngDYGFz/QCFg/K K8xQIaYocDNaeaKl0wGDo670wOEhd4J1LvWixH6oVmadXThbw6r/EcRKmKlNBLrBwh+B NRM6sITVzCMVC6WV6oYUhDkZN4c4ISJhw9x64kVAnhuMJzJencvZlTrRelfviUusi+xu cr1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=+eptxh6fVT4Jnbk58YruAWXhKovUIFSKc0pmnblSDXs=; b=eigCSpWv4bj6i6IMO6fvXN/A1oj+F7GNjf2thshgAgwgM2Y/Mcqz4UeEV24rwFVeiS w9vJLsPG3EkctZX5uFciwnDiAI9T8APiXxHvh2ebWKMtxjzdLTp6FrZrYrYZD/PAhfzY azEpTX6OMtXhmtuifE88XDV2NrBj+EJ4sJK/d0ymU+XV/DTGNRO3MTnqoDJ4x5DLuHUs k9iqlg5d80SNmfQKkjJbRxssPhgy4PhaaYM9IjM0yVe1sBCO1c+a8KuOWqsJ/0lQ0MB/ zPVcze+Rh+fRcHATaxqqOjfUzpNJtIxvahbBHgqqkeIVfXbPbk7aktKTrI9T2OUW5X7O aHiw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of romain.bazile@ubiant.com designates 188.165.48.182 as permitted sender) smtp.mailfrom=romain.bazile@ubiant.com Received: from 7.mo2.mail-out.ovh.net (7.mo2.mail-out.ovh.net. [188.165.48.182]) by gmr-mx.google.com with ESMTPS id q127si54106ywc.32.2017.10.06.02.46.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 02:46:03 -0700 (PDT) Received-SPF: pass (google.com: domain of romain.bazile@ubiant.com designates 188.165.48.182 as permitted sender) client-ip=188.165.48.182; Received: from player796.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id 689B1B2B86 for ; Fri, 6 Oct 2017 11:46:02 +0200 (CEST) Received: from localhost.localdomain (unknown [147.135.219.221]) (Authenticated sender: romain.bazile@ubiant.com) by player796.ha.ovh.net (Postfix) with ESMTPSA id 32EE15C00A6; Fri, 6 Oct 2017 11:46:01 +0200 (CEST) From: Romain Bazile To: swupdate@googlegroups.com Cc: Romain Bazile Subject: [swupdate] [PATCH] uboot: output error string on failure Date: Fri, 6 Oct 2017 11:45:29 +0200 Message-Id: <20171006094529.12292-1-romain.bazile@ubiant.com> X-Mailer: git-send-email 2.14.1 X-Ovh-Tracer-Id: 5825969069676059447 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrleefgddvudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecu X-Original-Sender: romain.bazile@ubiant.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of romain.bazile@ubiant.com designates 188.165.48.182 as permitted sender) smtp.mailfrom=romain.bazile@ubiant.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Makes the error easier to debug with the output of the error string Signed-off-by: Romain Bazile Acked-by: Stefano Babic --- bootloader/uboot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bootloader/uboot.c b/bootloader/uboot.c index 3b5a5ad..3697fe6 100644 --- a/bootloader/uboot.c +++ b/bootloader/uboot.c @@ -47,11 +47,11 @@ static int lock_uboot_env(void) int lockfd = -1; lockfd = open(lockname, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (lockfd < 0) { - ERROR("Error opening U-Boot lock file %s\n", lockname); + ERROR("Error opening U-Boot lock file %s, %s\n", lockname, strerror(errno)); return -1; } if (flock(lockfd, LOCK_EX) < 0) { - ERROR("Error locking file %s\n", lockname); + ERROR("Error locking file %s, %s\n", lockname, strerror(errno)); close(lockfd); return -1; } @@ -74,7 +74,7 @@ int bootloader_env_set(const char *name, const char *value) return -1; if (fw_env_open (fw_env_opts)) { - ERROR("Error: environment not initialized\n"); + ERROR("Error: environment not initialized, %s\n", strerror(errno)); unlock_uboot_env(lock); return -1; } @@ -103,7 +103,7 @@ char *bootloader_env_get(const char *name) return NULL; if (fw_env_open (fw_env_opts)) { - ERROR("Error: environment not initialized\n"); + ERROR("Error: environment not initialized, %s\n", strerror(errno)); unlock_uboot_env(lock); return NULL; } @@ -126,7 +126,7 @@ int bootloader_apply_list(const char *filename) lockfd = lock_uboot_env(); if (lockfd < 0) { - ERROR("Error opening U-Boot lock file %s\n", lockname); + ERROR("Error opening U-Boot lock file %s, %s\n", lockname, strerror(errno)); return -ENODEV; }