If fork fails, close the incoming socket
This commit is contained in:
parent
53c3963497
commit
72aa1646f6
1 changed files with 3 additions and 3 deletions
6
main.c
6
main.c
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue