OT: Kernel 2.2.x bug. Standard output not flushed before fork

David B. Rees (dbr@spoke.nols.com)
Mon, 07 Jun 1999 11:58:52 -0700 (PDT)


On 07-Jun-99 Juan Piernas Cánovas wrote:
> This is not good, isn't it?. Well, I have a program that
> creates one o more process. Before fork, the father
> process write some messages to standard output and then it
> creates some sons. The problem is sons inherit
> father's non flushed standard output, so father's messages
> appear two o more times. If I flush standard output before
> fork(), all is fine -- that is, father's messages appear
> once.

This is standard Unix behavior. You must flush buffers before forking to avoid
duplicate output.

-Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/