The `result` structure of the `readdir_r` function will not need to be
part of the TLS, the `entry` structure alone is enough.
Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #963
struct dirent *readdir(DIR *dir)
{
- static __thread struct dirent entry, *result;
- int ret;
+ static __thread struct dirent entry;
+ struct dirent *result;
- ret = readdir_r(dir, &entry, &result);
- if (ret) {
- errno = ret;
- return NULL;
- }
+ errno = readdir_r(dir, &entry, &result);
- errno = 0;
return result;
}