From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
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 <[email protected]>

---
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.

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000009125f7060c9082bb%40google.com.

Reply via email to