tools/nolibc/dirent: avoid errno in readdir_r

Using errno is not possible when NOLIBC_IGNORE_ERRNO is set. Use
sys_lseek instead of lseek as that avoids using errno.

Fixes: 665fa8dea9 ("tools/nolibc: add support for directory access")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
Benjamin Berg
2025-09-24 16:20:51 +02:00
committed by Thomas Weißschuh
parent c485ca3aff
commit 4ada5679f1

View File

@@ -86,9 +86,9 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
* readdir() can only return one entry at a time.
* Make sure the non-returned ones are not skipped.
*/
ret = lseek(fd, ldir->d_off, SEEK_SET);
if (ret == -1)
return errno;
ret = sys_lseek(fd, ldir->d_off, SEEK_SET);
if (ret < 0)
return -ret;
entry->d_ino = ldir->d_ino;
/* the destination should always be big enough */