A problem about child process.# Unix - 噫吁兮,危乎高哉
l*t
1 楼
if( (pid = fork()) == 0 )}
.....
i = execvp(xxx,xxxxx[]);
if( i == -1 ){
printf("error!");
//kill(pid,9) ???
}
}
ps
1201 proc1
1203 proc1
.....
when execvp fail, the child process 1203 is
still runing,if I use kill when fail,the
process 1201 will be killed too.
How can I kill 1203 only when exec fail?
thanks!
.....
i = execvp(xxx,xxxxx[]);
if( i == -1 ){
printf("error!");
//kill(pid,9) ???
}
}
ps
1201 proc1
1203 proc1
.....
when execvp fail, the child process 1203 is
still runing,if I use kill when fail,the
process 1201 will be killed too.
How can I kill 1203 only when exec fail?
thanks!