Closed Bug 204151 Opened 22 years ago Closed 18 years ago

A process created by PR_CreateProcess with an inherited fd can't pass any inheritable fd to a child process created by PR_CreateProcess.

Categories

(NSPR :: NSPR, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(1 file, 1 obsolete file)

If a process was itself created by PR_CreateProcess with an inherited fd, it won't be able to pass any inheritable fd's to a child process created by PR_CreateProcess. NSPR passes the values of inheritable fd's in a magic environment variable in the child process's environment. If a process was itself created by PR_CreateProcess, it will have that magic environment variable in its environment. If this process calls PR_CreateProcess with an inheritable fd, it will append the magic environment variable to the current environment, without checking if the magic environment variable already exists. So the child's environment array ends up with two entries of that magic environment variable, with the wrong one appearing before the right one. When the child process gets its inherited fd, it gets the wrong value.
Attached patch Proposed patch (obsolete) — Splinter Review
Search for existing NSPR_INHERIT_FDS environment variable in the environment. If it exists, replace it with the new value rather than appending the new value to the environment.
Attachment #124021 - Flags: review?(sfraser)
Attachment #124021 - Flags: review?(sfraser)
The previous patch has a bug in the Windows code. The second argument to qsort() may be incorrect.
Attachment #124021 - Attachment is obsolete: true
Attachment #124044 - Flags: review?(sfraser)
Do we still need this?
Yes, we should still fix this bug even though the affected customer has implemented a workaround.
Attachment #124044 - Flags: review?(sfraser_bugs) → review+
QA Contact: wtchang → nspr
is this ready for check in?
I checked in the patch on the NSPR trunk for NSPR 4.7. Checking in beos/bproc.c; /cvsroot/mozilla/nsprpub/pr/src/md/beos/bproc.c,v <-- bproc.c new revision: 3.7; previous revision: 3.6 done Checking in unix/uxproces.c; /cvsroot/mozilla/nsprpub/pr/src/md/unix/uxproces.c,v <-- uxproces.c new revision: 3.21; previous revision: 3.20 done Checking in windows/ntmisc.c; /cvsroot/mozilla/nsprpub/pr/src/md/windows/ntmisc.c,v <-- ntmisc.c new revision: 3.23; previous revision: 3.22 done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: