You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Erik Rantapaa <ra...@fanbuzz.com> on 2002/01/11 23:53:35 UTC

problem with dup() in mod-perl?

Is anyone aware of a problem with dup-ing a fd to stdin?
Attached is a module I'm using to get the output of an exec-ed command.

When I call this module from a script it gives the right output.
When I call this from a Mason module, I get "0 0 0" (as if no input was read).
When I call this from the single threaded server (using -X), the request
hangs, and it seems to be taking input from my shell (the shell that
invoked 'httpd -X').

If I run strace on httpd, instead of a "dup2(X, 0)" call, I see a single
argument call "dup(X)"; the dup to stdout is a dup2() call.

It seems that someone is intercepting the dup2(X, 0) call and treating it
as a single argument dup() call.

My platform:

Apache: 1.3.22
mod_perl: 1.26
Linux: Redhat 7.2/Intel