[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible race in pserver leading to broken pipe error?

From: Larry Jones
Subject: Re: Possible race in pserver leading to broken pipe error?
Date: Wed, 11 Feb 2004 11:35:52 -0500 (EST)

Steve McIntyre writes:
> fsync() or fdatasync() should do what you want here. Although you
> _should_ be able to mix stream and fd operations normally - stdio is
> meant to do the right thing AFAIK. But now I can't find the reference
> I had that said so, of course.

On the contrary, stdio expects to have exclusive control of the fd so
you have to be very careful when that isn't the case to keep things from
getting out of sync and producing undefined behavior.  There's a
discussion in the current Posix spec about the interaction and what you
have to do to make things work right:


In this particular case -- close()ing the fd underlying a stream --
there is at least one implementation where that causes the program to
crash when the stream is later closed (either explicitly or implicitly
when the program ends) which tries to close the fd again.

-Larry Jones

I've never seen a sled catch fire before. -- Hobbes

reply via email to

[Prev in Thread] Current Thread [Next in Thread]