...
The only function available on POSIX systems to collect information about a symbolic link rather than its target is the lstat() function. This non-compliant code example uses the lstat() function to collection collect information about the file, and then checks the st_mode field to determine if the file is a symbolic link.
...