This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fork() and file descriptors with un-flushed output


On 8/27/2012 11:26 PM, thoni56 wrote:
> Is this a known behaviour? Unavoidable in cygwin? (Obviously not, if I'm on
> the right track with my guesswork...) If it is a bug, will it be fixed?

This behavior isn't Cygwin-specific. In fact, it's longstanding Unix behavior.
(The buffering problem is one reason you should, generally speaking, use
_exit(2), not exit(3), in a forked child.) Calling fflush(NULL) before the fork
will flush all stdio buffers for you and eliminate the problem, assuming you're
single-threaded.

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]