Skip to content

Commit

Permalink
daemon.c: squelch error message from EINTR
Browse files Browse the repository at this point in the history
Every time after servicing the connection, select() first fails
with EINTR and ends up waiting for one second before serving the
next client.  The sleep() was placed by the original author per
suggestion from the list to avoid spinning on failing select,
but at least this EINTR situation should not result in "at most
one client per second" service limit.

I am not sure if this is the right fix, but WTH.  The king
penguin says that serious people would run the daemon under
inetd anyway, and I agree with that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Aug 5, 2005
1 parent 1215879 commit 1eef0b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,11 @@ static int serve(int port)
fds = fds_init;

if (select(maxfd + 1, &fds, NULL, NULL, NULL) < 0) {
error("select failed, resuming: %s", strerror(errno));
sleep(1);
if (errno != EINTR) {
error("select failed, resuming: %s",
strerror(errno));
sleep(1);
}
continue;
}

Expand Down

0 comments on commit 1eef0b3

Please sign in to comment.