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 a15403958 nsh_dd: fix lseek return check.
a15403958 is described below
commit a15403958d5677c491effb611875e3b71c02393b
Author: Denis Ryndine <[email protected]>
AuthorDate: Tue Jul 30 10:19:20 2024 +1000
nsh_dd: fix lseek return check.
- As was merged in commit 1852731df87e5895e299b74aabdb1984b7e3f795 on
dd_main.c: lseek returns -1 on error.
Should be consistent in nsh_ddcmd.c and nsh_main.c.
---
nshlib/nsh_ddcmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c
index 5e7ebe957..470518fdb 100644
--- a/nshlib/nsh_ddcmd.c
+++ b/nshlib/nsh_ddcmd.c
@@ -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;