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 */
|
/* fork and handle */
|
||||||
switch ((spid = fork())) {
|
switch ((spid = fork())) {
|
||||||
case -1:
|
|
||||||
warn("fork:");
|
|
||||||
continue;
|
|
||||||
case 0:
|
case 0:
|
||||||
serve(infd, &in_sa);
|
serve(infd, &in_sa);
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
case -1:
|
||||||
|
warn("fork:");
|
||||||
|
/* fallthrough */
|
||||||
default:
|
default:
|
||||||
/* close the connection in the parent */
|
/* close the connection in the parent */
|
||||||
close(infd);
|
close(infd);
|
||||||
|
|
Loading…
Reference in a new issue