From 72aa1646f69fc738b8df2afaa1b8f4ae9df4c68f Mon Sep 17 00:00:00 2001 From: Laslo Hunhold Date: Fri, 23 Feb 2018 22:40:47 +0100 Subject: [PATCH] If fork fails, close the incoming socket --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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);