diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-07-07 14:12:57 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-07 14:12:57 -0700 |
| commit | 844911960ca081ff827a688dbfdf95fdc191881d (patch) | |
| tree | d3880edc3c52a2048dfb0ba455dbadf7c8aad039 | |
| parent | Merge branch 'jk/fix-leak-send-pack' (diff) | |
| parent | daemon: correctly handle soft accept() errors in service_loop (diff) | |
| download | git-844911960ca081ff827a688dbfdf95fdc191881d.tar.gz git-844911960ca081ff827a688dbfdf95fdc191881d.zip | |
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
| -rw-r--r-- | daemon.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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: |
