I recently read code in unp(),in chp 5.9, on the book, when handling zombies, the author use
signal(SIGCHLD, sig_chld);
Also, inside the sig_chld, the code is as following:
void sig_chld(int signo){
pid_t pid;
int stat;
pid = wait(&stat);
printf("child %d terminated\",pid);
return;
}
I have tried this, and I successfully handled zombies, but the function printf can't work normally. Why? If more information is needed, just comment. Thanks!!!