On Fri, 2009-10-30 at 17:13 +1100, Bojan Smojver wrote:
> It gets worse - they may get an FD which was reused by yet another
> thread. Quite dangerous.

What I am getting at here is a particular situation where the thread
closing of our file has been suspended (say, got a signal and is now in
sigsuspend() within the signal handler, waiting for another signal to be
woken up).

If it so happens that close() just successfully finished and
file->filedes was not set to -1 yet, there is a possibility that the FD
returned by apr_file_os_get() may be an FD reused already by another
thread (or at least, it will be closed).

If we set file->filedes to -1 early, we can at least defend against that
use case.

-- 
Bojan

Reply via email to