X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=daemon.c;h=b9ba44c582b3b6cfac0f150f7f8901d60b48bbb3;hb=1e2bba92d21d9c72d4a6816c3a98a22779856f9e;hp=0e026f65ecc089c869979069b33aabc1008d3f68;hpb=48196afd2827b36ca5768f886f0866b6dfebdd10;p=git.git diff --git a/daemon.c b/daemon.c index 0e026f65e..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); @@ -1116,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;