Skip to content

Commit

Permalink
nsh_dd: fix lseek return check.
Browse files Browse the repository at this point in the history
 - As was merged in commit 1852731 on
   dd_main.c: lseek returns -1 on error.

   Should be consistent in nsh_ddcmd.c and nsh_main.c.
  • Loading branch information
Denis Ryndine authored and xiaoxiang781216 committed Aug 1, 2024
1 parent 3d8536f commit a154039
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nshlib/nsh_ddcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
if (dd.skip)
{
ret = lseek(dd.infd, dd.skip * dd.sectsize, SEEK_SET);
if (ret < -1)
if (ret < 0)
{
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "skip lseek", NSH_ERRNO);
ret = ERROR;
Expand All @@ -396,7 +396,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
if (dd.seek)
{
ret = lseek(dd.outfd, dd.seek * dd.sectsize, SEEK_SET);
if (ret < -1)
if (ret < 0)
{
nsh_error(vtbl, g_fmtcmdfailed, g_dd, "seek lseek", NSH_ERRNO);
ret = ERROR;
Expand Down

0 comments on commit a154039

Please sign in to comment.