Re: Still more pty problems
Re: Still more pty problems
- Subject: Re: Still more pty problems
- From: Jonas Maebe <email@hidden>
- Date: Fri, 16 Sep 2011 22:26:26 +0200
On 16 Sep 2011, at 22:12, Ingemar Ragnemalm wrote:
> Thanks, but it doesn't explain why it would fail after a pretty exact number of runs. And it still does, with the correction.
You also have to reap the child processes. So something like this:
void RunTest(int i)
{
int pty, childpid, res;
switch((childpid=forkpty(&pty, NULL, NULL, NULL)))
{
case -1: // Error
printf("pty error after %d\n", i); exit(1);
case 0: // Child
_exit(0);
default: // Parent
do
{
res = close(pty);
} while ((res == -1) && (errno == EINTR));
do {
res = waitpid(childpid,NULL,0);
} while ((res == -1) && (errno == EINTR));
}
}
Jonas _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden