On 10/10/2010 9:20 AM, Erik Faye-Lund wrote:
fork() is only available on POSIX, so to support git-daemon on Windows we have to use something else. Instead we invent the flag --serve, which is a stripped down version of --inetd-mode. We use start_command() to call git-daemon with this flag appended to serve clients. Signed-off-by: Erik Faye-Lund<kusmabite@xxxxxxxxx> --- @@ -654,14 +641,14 @@ static void remove_child(pid_t pid) */ static void kill_some_child(void) { - const struct child *blanket, *next; + struct child *blanket, *next;
It is not immediately obvious why 'const' was dropped.
@@ -671,18 +658,26 @@ static void check_dead_children(void) int status; pid_t pid; - while ((pid = waitpid(-1,&status, WNOHANG))> 0) { - const char *dead = ""; - remove_child(pid); - if (!WIFEXITED(status) || (WEXITSTATUS(status)> 0)) - dead = " (with error)"; - loginfo("[%"PRIuMAX"] Disconnected%s", (uintmax_t)pid, dead); - } + struct child **cradle, *blanket; + for (cradle =&firstborn; (blanket = *cradle);) + if ((pid = waitpid(blanket->cld.pid,&status, WNOHANG))> 1) { + const char *dead = ""; + if (status) + dead = " (with error)"; + loginfo("[%"PRIuMAX"] Disconnected%s", (uintmax_t)pid, dead); + + /* remove the child */ + *cradle = blanket->next; + live_children--; + free(blanket); + } else + cradle =&blanket->next; } +char **cld_argv; static void handle(int incoming, struct sockaddr *addr, int addrlen) {
Should 'cld_argv' be declared static? -- ES -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html