From 3d4442207d8901e2530e19a882d4e9e96c49aece Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Fri, 8 Sep 2023 21:33:35 +0800 Subject: [PATCH] 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 --- nshlib/nsh_ddcmd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c index 8c6c22435..c6f30b098 100644 --- a/nshlib/nsh_ddcmd.c +++ b/nshlib/nsh_ddcmd.c @@ -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; } @@ -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; }