redfacedquark•

Tumbleweed...let me take a stab at it. By the time it opens the file it has already followed the symlink to the target file?

16
suspiciously_calm•

Yes, fstat works on a file descriptor, and it's impossible to open a file descriptor to a symlink.

Either you follow the symlink and open the target (which PHP does), or you declare that you don't want to follow symlinks (O_NOFOLLOW), in which case an open() on a symlink fails.

Edit: Apparently nowadays there's a flag for that.

7
sstewartgallus•

Actually, O_PATH | O_NOFOLLOW lets one open a file descriptor to a symlink.

5
suspiciously_calm•

Kids these days with their fancy flags.

8
shitbangs•

More like kids these days with their non-portable system calls

6
[deleted]•

[deleted]

6
MMDeveloper•

I pity the fool who solely relies on the existence of a php session to verify a valid user.

3