mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-31 14:13:09 +00:00
system/dd: align nshlib/cmd_dd
nshlib/cmd_dd: Retry if read() was interrupted
Without this patch
nsh> ls /etc/group | dd | dd
sh [13:100]
sh [14:100]
nsh: dd: read failed: 4
nsh>
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
2a52c4c7f5
commit
b608dd0e3f
1 changed files with 6 additions and 1 deletions
|
|
@ -135,6 +135,11 @@ static int dd_read(FAR struct dd_s *dd)
|
|||
nbytes = read(dd->infd, buffer, dd->sectsize - dd->nbytes);
|
||||
if (nbytes < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: failed to read: %s\n", g_dd, strerror(errno));
|
||||
return ERROR;
|
||||
}
|
||||
|
|
@ -147,7 +152,7 @@ static int dd_read(FAR struct dd_s *dd)
|
|||
break;
|
||||
}
|
||||
}
|
||||
while (dd->nbytes < dd->sectsize && nbytes > 0);
|
||||
while (dd->nbytes < dd->sectsize && nbytes != 0);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue