aboutsummaryrefslogtreecommitdiffstats
path: root/daemon.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-07-07 14:12:57 -0700
committerJunio C Hamano <gitster@pobox.com>2025-07-07 14:12:57 -0700
commit844911960ca081ff827a688dbfdf95fdc191881d (patch)
treed3880edc3c52a2048dfb0ba455dbadf7c8aad039 /daemon.c
parentd4a59c5a29c3b7145c2835e2cde007d96d550e0a (diff)
parent78b6601ca39015b7c6df9c5c323e9a7df74dee26 (diff)
downloadgit-844911960ca081ff827a688dbfdf95fdc191881d.tar.gz
Merge branch 'cb/daemon-retry-interrupted-accept'
When "git daemon" sees a signal while attempting to accept() a new client, instead of retrying, it skipped it by mistake, which has been corrected. * cb/daemon-retry-interrupted-accept: daemon: correctly handle soft accept() errors in service_loop
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/daemon.c b/daemon.c
index 99741f0b45..61cd50f720 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1148,11 +1148,19 @@ static int service_loop(struct socketlist *socklist)
#endif
} ss;
socklen_t sslen = sizeof(ss);
- int incoming = accept(pfd[i].fd, &ss.sa, &sslen);
+ int incoming;
+ int retry = 3;
+
+ redo:
+ incoming = accept(pfd[i].fd, &ss.sa, &sslen);
if (incoming < 0) {
switch (errno) {
- case EAGAIN:
case EINTR:
+ if (--retry)
+ goto redo;
+
+ /* fallthrough */
+ case EAGAIN:
case ECONNABORTED:
continue;
default: