Code:
pid = fork();
if (pid < 0){ error("Error: Cannot create new proces"); return EXIT_FAILURE;}
if (pid == 0) {
i++;
close(sockfd);
dostuff(newsockfd,i+pid);
close(newsockfd);
return EXIT_SUCCESS;
}
Now the problem is that if this process runs for a week or so it has forked so many times that the ps aux list is full of zombies.
I used to know how to deal with zombies but i seem to have forgotten it. Please help me. The parent doen't need any information of the child when te child ends? So how do I prevent that the child turn into a zombie after the child dies.