From: Jens Axboe Date: Thu, 20 Oct 2005 07:52:32 +0000 (-0700) Subject: git-daemon poll() spinning out of control X-Git-Tag: v0.99.9~78 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7872e0556746c70e49c5558d271d35b1fbfb1680;p=git.git git-daemon poll() spinning out of control With the '0' timeout given to poll, it returns instantly without any events on my system, causing git-daemon to consume all the CPU time. Use -1 as the timeout so poll() only returns in case of EINTR or actually events being available. Signed-off-by: Jens Axboe Signed-off-by: Junio C Hamano --- diff --git a/daemon.c b/daemon.c index c3381b34..b3bcd7a6 100644 --- a/daemon.c +++ b/daemon.c @@ -533,7 +533,7 @@ static int service_loop(int socknum, int *socklist) for (;;) { int i; - if (poll(pfd, socknum, 0) < 0) { + if (poll(pfd, socknum, -1) < 0) { if (errno != EINTR) { error("poll failed, resuming: %s", strerror(errno));