[PATCH 2/2] commands: ubiupdatevol: confirm success with return value 0

Ulrich Ölmann u.oelmann at pengutronix.de
Mon Sep 5 12:36:18 PDT 2016


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 at 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




More information about the barebox mailing list