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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux