Skip to content

Commit 3d44422

Browse files
CV-Bowenxiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent 51762a8 commit 3d44422

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

nshlib/nsh_ddcmd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ static int dd_write(FAR struct dd_s *dd)
105105
if (nbytes < 0)
106106
{
107107
FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
108-
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "write",
109-
NSH_ERRNO_OF(-nbytes));
108+
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "write", NSH_ERRNO);
110109
return ERROR;
111110
}
112111

@@ -134,8 +133,7 @@ static int dd_read(FAR struct dd_s *dd)
134133
if (nbytes < 0)
135134
{
136135
FAR struct nsh_vtbl_s *vtbl = dd->vtbl;
137-
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "read",
138-
NSH_ERRNO_OF(-nbytes));
136+
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "read", NSH_ERRNO);
139137
return ERROR;
140138
}
141139

0 commit comments

Comments
 (0)