mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 11:23:07 +08:00
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 <anjiahao@xiaomi.com>
This commit is contained in:

committed by
Alan Carvalho de Assis

parent
283b1a4dfc
commit
4680a25a8c
@@ -102,7 +102,7 @@ static int dd_write(FAR struct dd_s *dd)
|
|||||||
written = 0;
|
written = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
nbytes = write(dd->outfd, buffer, dd->sectsize - written);
|
nbytes = write(dd->outfd, buffer, dd->nbytes - written);
|
||||||
if (nbytes < 0)
|
if (nbytes < 0)
|
||||||
{
|
{
|
||||||
FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
|
FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
|
||||||
@@ -114,7 +114,7 @@ static int dd_write(FAR struct dd_s *dd)
|
|||||||
written += nbytes;
|
written += nbytes;
|
||||||
buffer += nbytes;
|
buffer += nbytes;
|
||||||
}
|
}
|
||||||
while (written < dd->sectsize);
|
while (written < dd->nbytes);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user