X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=daemon.c;h=b9ba44c582b3b6cfac0f150f7f8901d60b48bbb3;hb=1e2bba92d21d9c72d4a6816c3a98a22779856f9e;hp=c315932ced825f96f669003616a9fb304309c75d;hpb=b281eea75f0ab68e3c9510323c73b78cd3e62814;p=git.git diff --git a/daemon.c b/daemon.c index c315932ce..b9ba44c58 100644 --- a/daemon.c +++ b/daemon.c @@ -537,6 +537,10 @@ static int execute(struct sockaddr *addr) #endif } loginfo("Connection from %s:%d", addrbuf, port); + setenv("REMOTE_ADDR", addrbuf, 1); + } + else { + unsetenv("REMOTE_ADDR"); } alarm(init_timeout ? init_timeout : timeout); @@ -1083,7 +1087,8 @@ int main(int argc, char **argv) openlog("git-daemon", LOG_PID, LOG_DAEMON); set_die_routine(daemon_die); } else - setlinebuf(stderr); /* avoid splitting a message in the middle */ + /* avoid splitting a message in the middle */ + setvbuf(stderr, NULL, _IOLBF, 0); if (inetd_mode && (group_name || user_name)) die("--user and --group are incompatible with --inetd"); @@ -1115,13 +1120,9 @@ int main(int argc, char **argv) if (strict_paths && (!ok_paths || !*ok_paths)) die("option --strict-paths requires a whitelist"); - if (base_path) { - struct stat st; - - if (stat(base_path, &st) || !S_ISDIR(st.st_mode)) - die("base-path '%s' does not exist or " - "is not a directory", base_path); - } + if (base_path && !is_directory(base_path)) + die("base-path '%s' does not exist or is not a directory", + base_path); if (inetd_mode) { struct sockaddr_storage ss;