You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/02/24 13:21:40 UTC

[incubator-nuttx-apps] branch master updated: cmd_dd:if read nbyte less than bs, must write nbyte if a file size is 10 use dd if=a of=b bs = 8 b file size will 16, is a error Signed-off-by: anjiahao

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 4680a25  cmd_dd:if read nbyte less than bs,must write nbyte if a file size is 10 use dd if=a of=b bs = 8 b file size will 16, is a error Signed-off-by: anjiahao <an...@xiaomi.com>
4680a25 is described below

commit 4680a25a8cbe74df3193487851dfcd9b98bec7b8
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Mon Feb 21 17:39:09 2022 +0800

    cmd_dd:if read nbyte less than bs,must write nbyte
    if a file size is 10
    use dd if=a of=b bs = 8
    b file size will 16, is a error
    Signed-off-by: anjiahao <an...@xiaomi.com>
---
 nshlib/nsh_ddcmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c
index ee800f7..0b05860 100644
--- a/nshlib/nsh_ddcmd.c
+++ b/nshlib/nsh_ddcmd.c
@@ -102,7 +102,7 @@ static int dd_write(FAR struct dd_s *dd)
   written = 0;
   do
     {
-      nbytes = write(dd->outfd, buffer, dd->sectsize - written);
+      nbytes = write(dd->outfd, buffer, dd->nbytes - written);
       if (nbytes < 0)
         {
           FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
@@ -114,7 +114,7 @@ static int dd_write(FAR struct dd_s *dd)
       written += nbytes;
       buffer  += nbytes;
     }
-  while (written < dd->sectsize);
+  while (written < dd->nbytes);
 
   return OK;
 }