in reply to Re^2: readdir() on a sysopen() handle?
in thread readdir() on a sysopen() handle?

The problem is that an entry might change from a directory to a symbolic link between the stat() and the open(). O_NOFOLLOW prevents such race conditions.
I fail to see why or how O_NOFOLLOW would prevent this from happening if you were thinking about doing a sysopen followed by a readdir or anything more or less equivalent with a different system call.

Maybe you should explain more precisely what you're really trying to do.

Replies are listed 'Best First'.
Re^4: readdir() on a sysopen() handle?
by Anonymous Monk on Aug 20, 2017 at 18:10 UTC

    I can't speak for the OP, but—

    Problems such as this often arise in scenarios where the effective user has more privileges than necessary for the intended operation. Then the program must either juggle with privileges/capabilities, or otherwise take precaution.