]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/vfscore: Remove readdir_r result from TLS
authorStefan Jumarea <stefanjumarea02@gmail.com>
Sun, 30 Jul 2023 09:30:02 +0000 (12:30 +0300)
committerUnikraft <monkey@unikraft.io>
Wed, 16 Aug 2023 13:12:51 +0000 (13:12 +0000)
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

lib/vfscore/main.c

index 1c5b15f45a78d6cb4a4488a678fb4b416adb0f99..5388376bb43570e241a3619a8b1675a006b7455f 100644 (file)
@@ -1148,16 +1148,11 @@ UK_SYSCALL_R_DEFINE(int, getdents64, int, fd, struct dirent64 *, dirp,
 
 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;
 }