Wednesday, February 7, 2024

[SOLVED] Is there such a thing as a posix lstatat call?

Issue

I am working on a FUSE and I have a file descriptor to the directory prior to mounting the fuse on top. I want to use that handle to read/write files with state information underneath the FUSE mounted file system, and then to be able to access that data next time I mount it. So I cannot use the normal lstat call since it won't see the files I want to access, but the files FUSE exposes instead. What I need is the equivalent of fstatat that works for symbolic links, since fstatat apparently gives the the stat info on the file the symbolic link points to, not the symbolic link itself. Yet I cannot find documentation for such a function. Does it exist? Am I thinking of an incorrect name?


Solution

There is no lstatat() function in POSIX. However, fstatat() takes a flag argument which can be AT_SYMLINK_NOFOLLOW, which is what you're looking for.



Answered By - user464502
Answer Checked By - Marie Seifert (WPSolving Admin)