yamt commented on code in PR #2456:
URL: https://github.com/apache/nuttx-apps/pull/2456#discussion_r1699516546
##########
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)
Review Comment:
a negative offset is a negative offset.
it's normal for some kind of files.
(i don't know if nuttx has such files or not though.
i don't know if it's relevant to this particular usage of lseek either.)
ie. a more pedantic check would be:
```
errno = 0;
off_t off = lseek(...);
if (off == (off_t)-1 && errno != 0) {
...
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]