Closed
Bug 46417
Opened 25 years ago
Closed 25 years ago
PR_ProcessAttrSetStdioRedirect misbehaves
Categories
(NSPR :: NSPR, enhancement, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
4.1
People
(Reporter: robm, Assigned: wtc)
Details
Attachments
(1 file)
2.52 KB,
patch
|
Details | Diff | Splinter Review |
I have a program I want to execute from a server program. I have a socket I want
to place on both standard input and standard output of the new program. I call:
PR_ProcessAttrSetStdioRedirect(attr, PR_StandardInput, mysock);
PR_ProcessAttrSetStdioRedirect(attr, PR_StandardOutput, mysock);
This causes a failure after exec(), because the code in uxproces.c which
executes after the fork() but before the exec() does something like this:
if we need to dup onto stdin
dup socket onto stdin
close the socket
if we need to dup onto stdout
dup socket onto stdout
close the socket
So, if the same socket is used for both, the dup will fail. I think this code
needs to close the file descriptors only after all of the dup's have happened,
and it probably also needs to check for doubles.
Assignee | ||
Updated•25 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → 4.1
Assignee | ||
Comment 1•25 years ago
|
||
Assignee | ||
Comment 2•25 years ago
|
||
I came up with a patch as you suggested (close the file
descriptors after all the dup's have happened, and check
for doubles). Please review and test it. Thanks.
Assignee | ||
Comment 3•25 years ago
|
||
I checked in the patch on the main trunk.
/cvsroot/mozilla/nsprpub/pr/src/md/unix/uxproces.c, revision 3.13
Rob, I'd still appreciate it if you could review and test the
patch. YThanks.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 4•25 years ago
|
||
Thanks! I'll give it a try and let you know if it doesn't work. It looks like it
will work very well.
You need to log in
before you can comment on or make changes to this bug.
Description
•