The following reply was made to PR general/1213; it has been noted by GNATS.
From: Marc Slemko <[EMAIL PROTECTED]> To: Garry Shtern <[EMAIL PROTECTED]> Cc: Apache bugs database <[EMAIL PROTECTED]> Subject: Re: general/1213 Date: Thu, 9 Oct 1997 13:53:03 -0600 (MDT) On Thu, 9 Oct 1997, Garry Shtern wrote: > On 9 Oct 1997 [EMAIL PROTECTED] wrote: > > > Synopsis: forking in cgi produces duplicate invocation of the script > > > > State-Changed-From-To: open-closed > > State-Changed-By: marc > > State-Changed-When: Thu Oct 9 06:33:38 PDT 1997 > > State-Changed-Why: > > This is a bug in your script. Please read all the big notices posted > > before > > submitting a PR; this has nothing to do with Apache. > > > > Somewhere your script has a bug in it. It may not be flushing output > > before forking, it may not be properly closing stdout in the child. > > Post to comp.infosystems.www.authoring.cgi and perhaps someone can help > > you. We don't have time to help everyone write their CGIs. > > > > I thought so too.. However, check this out... go to > http://www.akula.com/cgi-bin/test.pl?df=test > > and see what you get.. this is the script: > > #!/usr/bin/perl > use CGI; > $query = new CGI; > print $query->header; > > $pid=fork; > if ($pid) { > $value = $query->param('df'); > print "$value"; > exit; } -Garry So? Your script is broken. You are not flushing the IO buffers before forking, so they end up being flushed by the parent and the child. Add a "$| = 1;" to the start and perl will automatically flush them after each output, or you can manually flush them before forking in some way that I forget right now.
