commit 72aa1646f69fc738b8df2afaa1b8f4ae9df4c68f
Author: Laslo Hunhold <[email protected]>
AuthorDate: Fri Feb 23 22:40:47 2018 +0100
Commit: Laslo Hunhold <[email protected]>
CommitDate: Fri Feb 23 22:40:47 2018 +0100
If fork fails, close the incoming socket
diff --git a/main.c b/main.c
index 754299a..28b5163 100644
--- a/main.c
+++ b/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);