stat() not lstat()

Use stat() to get the stat record for the target of a symlink, not of the link itself (which lstat() does).
A check for the case where a file is symlink and the follow-symlink option is not set has already been made a few lines above, so this should be safe I think.