Skip to content

Commit

Permalink
nsh_ddcmd: print errno instead the return value when dd failed
Browse files Browse the repository at this point in the history
Print the errno gives more information to debug the dd failed
problem.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
  • Loading branch information
CV-Bowen authored and xiaoxiang781216 committed Jan 6, 2024
1 parent 51762a8 commit 3d44422
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions nshlib/nsh_ddcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ static int dd_write(FAR struct dd_s *dd)
if (nbytes < 0)
{
FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "write",
NSH_ERRNO_OF(-nbytes));
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "write", NSH_ERRNO);
return ERROR;
}

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

Expand Down

0 comments on commit 3d44422

Please sign in to comment.