Re: hang in CFStream code
Re: hang in CFStream code
- Subject: Re: hang in CFStream code
- From: James Matthews <email@hidden>
- Date: Thu, 1 May 2003 07:44:32 -0400
At 10:00 AM +0100 5/1/03, Quinn wrote:
Some questions:
1. Are you using fork or vfork? (fork is safer, vfork is faster)
vfork, but I also see the problem with fork
2. Do you do anything with the CFStream in the child process?
(that would be bad)
No.
3. In the child, what else do you do after the fork and before the exec?
I copy a socket descriptor to stdin/stdout; the code is based on
MoreSecExecuteRequestInHelperTool from MoreAuthSample:
// fork a child process
childPID = fork();
if (childPID == 0)
{
// this is the child executing
// first replace stdin and stdout with fdChild
fd = dup2(fdChild, STDIN_FILENO);
err = CheckErrno(fd);
if (err == noErr)
{
fd = dup2(fdChild, STDOUT_FILENO);
err = CheckErrno(fd);
}
// now close our extra copies of fdChild and fdParent
if (err == noErr)
{
junk = close(fdChild);
assert(junk == 0);
junk = close(fdParent);
assert(junk == 0);
// exec the child executable
err = CheckErrno(execl(inPath, inPath, nil));
}
Should I use a support incident?
Thanks,
--
Jim Matthews
Fetch Softworks
http://fetchsoftworks.com
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.