Skip to content

Commit 02a47ce

Browse files
ycsinnashif
authored andcommitted
fdtable: lseek's returned offset should start from 0
An offset of `>= 0` is valid from a `lseek` call, fix it. Signed-off-by: Yong Cong Sin <[email protected]>
1 parent 3ecef55 commit 02a47ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/os/fdtable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static inline off_t zvfs_lseek_wrap(int fd, int cmd, ...)
403403
va_start(args, cmd);
404404
res = fdtable[fd].vtable->ioctl(fdtable[fd].obj, cmd, args);
405405
va_end(args);
406-
if (res > 0) {
406+
if (res >= 0) {
407407
switch (fdtable[fd].mode & ZVFS_MODE_IFMT) {
408408
case ZVFS_MODE_IFDIR:
409409
case ZVFS_MODE_IFBLK:

0 commit comments

Comments
 (0)