X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=daemon.c;h=24bac16668ffe4d2301719c48a22c48ec449cf7f;hb=ee6566e8d70da682ac4926dd8a67ac821b2c1743;hp=eeff9e7b05fc9e84f8fef06a5322f9fbb3ec9eb2;hpb=80bd6f3064a6009cd18a4dab9ce6d29681cec4af;p=git.git diff --git a/daemon.c b/daemon.c index eeff9e7b..24bac166 100644 --- a/daemon.c +++ b/daemon.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -71,13 +72,13 @@ static int max_connections = 25; /* These are updated by the signal handler */ static volatile unsigned int children_reaped = 0; -pid_t dead_child[MAX_CHILDREN]; +static pid_t dead_child[MAX_CHILDREN]; /* These are updated by the main loop */ static unsigned int children_spawned = 0; static unsigned int children_deleted = 0; -struct child { +static struct child { pid_t pid; socklen_t addrlen; struct sockaddr_storage address; @@ -294,8 +295,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; } @@ -349,8 +353,10 @@ int main(int argc, char **argv) usage(daemon_usage); } - if (inetd_mode) + if (inetd_mode) { + fclose(stderr); //FIXME: workaround return execute(); + } return serve(port); }