nsh_ddcmd: print errno instead the return value when dd failed

Print the errno gives more information to debug the dd failed
problem.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang 2023-09-08 21:33:35 +08:00 committed by Xiang Xiao
parent 51762a8958
commit 3d4442207d

View File

@ -105,8 +105,7 @@ static int dd_write(FAR struct dd_s *dd)
if (nbytes < 0) if (nbytes < 0)
{ {
FAR struct nsh_vtbl_s *vtbl = dd->vtbl; FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "write", nsh_error(vtbl, g_fmtcmdfailed, g_dd, "write", NSH_ERRNO);
NSH_ERRNO_OF(-nbytes));
return ERROR; return ERROR;
} }
@ -134,8 +133,7 @@ static int dd_read(FAR struct dd_s *dd)
if (nbytes < 0) if (nbytes < 0)
{ {
FAR struct nsh_vtbl_s *vtbl = dd->vtbl; FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "read", nsh_error(vtbl, g_fmtcmdfailed, g_dd, "read", NSH_ERRNO);
NSH_ERRNO_OF(-nbytes));
return ERROR; return ERROR;
} }