If fork fails, close the incoming socket

This commit is contained in:
Laslo Hunhold 2018-02-23 22:40:47 +01:00
parent 53c3963497
commit 72aa1646f6

6
main.c
View file

@ -237,13 +237,13 @@ main(int argc, char *argv[])
/* fork and handle */
switch ((spid = fork())) {
case -1:
warn("fork:");
continue;
case 0:
serve(infd, &in_sa);
exit(0);
break;
case -1:
warn("fork:");
/* fallthrough */
default:
/* close the connection in the parent */
close(infd);