in reply to Re: opening files: link checking and race conditions
in thread opening files: link checking and race conditions

That's only useful for cooperating processes. The OP is talking about a malicious attempt to exploit a race condition.

The only thing I can think of is to use O_NOFOLLOW, which isn't portable (but should work on Linux and BSD systems):

use Fcntl; sysopen F, "/tmp/foo", O_RDONLY|O_NOFOLLOW;

Dave.