On 28 May 2010, at 06:23, Chen Chien-Yu wrote:

> Hi William,
> 
> I reckon it should be mod_cgi, the CGI library I use is called "GNU CGI 
> Library in C, v0.9.5" which has been maintained for many years. 
> 
> The function below is the way the CGI init and open the stream.
> 
> gcgiReturnType
> initCgi( )
> {
>     /* Dup stdout to gcgiOut */
>     gcgifd = dup(fileno(stdout));
>     gcgiOut = fdopen(gcgifd, "w");

Huh?  Why dup stdout?  And who manages closing it?

> Then, free the resource but I didn't see it close the file descriptor. It 
> duplicate the standard output, is that the reason that don't have to close 
> it? I've tried to close the stdout, stderr, gcgiOut, stdin, but that didn't 
> work.

You should be able (but not normally required) to close your file descriptors 
in CGI.
But the dup introduced unexpected complexity.

If all that's from the cgi lib you're using, maybe you should put it to the 
maintainers of that,
and perhaps try and post somewhere a minimal CGI program that demonstrates your 
problem.

-- 
Nick Kew
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to