Effectively, fork inherits everything from it's parent, even memory. But it gets "copy" of everything. If the child performs "exec", then new process inherits only file descriptors that have FD_CLOEXEC flag cleared. Usually, this is used by the Web server that starts CGI scripts. The server establishes stdout and stdin of the forked child to use created by the Web server pipes and then does "exec" that will run CGI script.
Looks like, your Web server waits till the CGI script closes both STDOUT and STDERR. Which means, that actually all of the data sent to STDERR goes first to Web server and then Web server forwards it to appropriate log file. Most likely, your script does not have enough privileges to open that file. The simplest solution is for your forked child to use different file.
In reply to Re: CGI fork() inherits
by andal
in thread CGI fork() inherits
by asohn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |