Added forked processes termination
This commit is contained in:
parent
72eb14f9e0
commit
15147b6430
@ -58,6 +58,11 @@ void handle_connection(int fd)
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_process_termination(int signum)
|
||||||
|
{
|
||||||
|
wait(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main
|
* Main
|
||||||
*/
|
*/
|
||||||
@ -116,8 +121,10 @@ int main(int argc, char *argv[])
|
|||||||
handle_connection(client_fd);
|
handle_connection(client_fd);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
close(client_fd);
|
close(client_fd);
|
||||||
|
signal(SIGCHLD, handle_process_termination);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user