mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
nshlib/cmd_cat: Retry if nsh_read was interrupted by a signal
When read from stdio of child process through pipe, SIGCHLD received if child exits. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
e2a21337ac
commit
ebc19a60ff
1 changed files with 10 additions and 1 deletions
|
|
@ -802,10 +802,19 @@ int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
|||
while (true)
|
||||
{
|
||||
ret = nsh_read(vtbl, buf, BUFSIZ);
|
||||
if (ret <= 0)
|
||||
if (ret == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (ret < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
nsh_write(vtbl, buf, ret);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue