...
if (0 == (pid1 = fork()))
{
if (0 == (pid2 = fork())) //in process(pid2), pid2 is the child of pid1.
{
execlp(...);
goto error_exec;
}
else if (pid2 > 0) // in process(pid1)
{
exit(0);
}
else // in process(pid1)
goto error_fork2;
}
else if (pid1 > 0)
{
waitpid(pid1, &status, 0);
...
}
else
goto error_fork1;
...
请教一下为什么儿子进程exit失败,父进程一直在wait?