mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] commands: ubiupdatevol: confirm success with return value 0
Date: Mon,  5 Sep 2016 21:36:18 +0200	[thread overview]
Message-ID: <1473104178-20389-2-git-send-email-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <1473104178-20389-1-git-send-email-u.oelmann@pengutronix.de>

Treat the write() case analogously to the read() case and do not return the
number of most recently written bytes as the status of sucessful command
execution.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 commands/ubi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/commands/ubi.c b/commands/ubi.c
index dd981f95ea5d..26b521f3748e 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -65,9 +65,10 @@ static int do_ubiupdatevol(int argc, char *argv[])
 			break;
 		}
 
-		ret = write(fd_vol, buf, count);
-		if (ret < 0) {
+		count = write(fd_vol, buf, count);
+		if (count < 0) {
 			perror("write");
+			ret = 1;
 			break;
 		}
 
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-09-05 19:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 19:36 [PATCH 1/2] commands: ubiupdatevol: store return value of read() in a signed int Ulrich Ölmann
2016-09-05 19:36 ` Ulrich Ölmann [this message]
2016-09-06 14:21 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473104178-20389-2-git-send-email-u.oelmann@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox