mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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:
committed by
Thomas Weißschuh
parent
c485ca3aff
commit
4ada5679f1
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user