[COMMIT osv master] __fxstatat: make it handle AT_SYMLINK_NOFOLLOW

4 views
Skip to first unread message

Commit Bot

unread,
Dec 15, 2023, 1:24:27 PM12/15/23
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

__fxstatat: make it handle AT_SYMLINK_NOFOLLOW

This patch makes tst-symlink tests pass when running on OSv
with dynamic linker. In this case lstat() and stat() are handled
by glibc by calling system call fstatat.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc
--- a/fs/vfs/main.cc
+++ b/fs/vfs/main.cc
@@ -639,7 +639,12 @@ int __fxstatat(int ver, int dirfd, const char *pathname, struct stat *st,
}

if (pathname[0] == '/' || dirfd == AT_FDCWD) {
- return stat(pathname, st);
+ if (flags & AT_SYMLINK_NOFOLLOW) {
+ return lstat(pathname, st);
+ }
+ else {
+ return stat(pathname, st);
+ }
}
// If AT_EMPTY_PATH and pathname is an empty string, fstatat() operates on
// dirfd itself, and in that case it doesn't have to be a directory.
Reply all
Reply to author
Forward
0 new messages