nsh_dd: fix lseek return check.

- As was merged in commit 1852731df8 on
   dd_main.c: lseek returns -1 on error.

   Should be consistent in nsh_ddcmd.c and nsh_main.c.
This commit is contained in:
Denis Ryndine 2024-07-30 10:19:20 +10:00 committed by Xiang Xiao
parent 3d8536f380
commit a15403958d

View File

@ -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;
@ -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;