You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/01/06 12:34:12 UTC

(nuttx-apps) branch master updated: nsh_ddcmd: print errno instead the return value when dd failed

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d4442207 nsh_ddcmd: print errno instead the return value when dd failed
3d4442207 is described below

commit 3d4442207d8901e2530e19a882d4e9e96c49aece
Author: Bowen Wang <wa...@xiaomi.com>
AuthorDate: Fri Sep 8 21:33:35 2023 +0800

    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 <wa...@xiaomi.com>
---
 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;
         }