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
maint
Junio C Hamano 2025-07-07 14:12:57 -07:00
commit 844911960c
1 changed files with 10 additions and 2 deletions

View File

@ -1148,11 +1148,19 @@ static int service_loop(struct socketlist *socklist)
#endif #endif
} ss; } ss;
socklen_t sslen = sizeof(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) { if (incoming < 0) {
switch (errno) { switch (errno) {
case EAGAIN:
case EINTR: case EINTR:
if (--retry)
goto redo;

/* fallthrough */
case EAGAIN:
case ECONNABORTED: case ECONNABORTED:
continue; continue;
default: default: