Make report() from usage.c public as vreportf() and use it.
[gitweb.git] / http-backend.c
index f729488fc5f787c0f4997aacdd1bb14732d717f7..8c7b7d09eaae0d5ac1f3d00f5e3bf9ceb92b54de 100644 (file)
@@ -538,14 +538,11 @@ static void service_rpc(char *service_name)
 
 static NORETURN void die_webcgi(const char *err, va_list params)
 {
-       char buffer[1000];
-
        http_status(500, "Internal Server Error");
        hdr_nocache();
        end_headers();
 
-       vsnprintf(buffer, sizeof(buffer), err, params);
-       fprintf(stderr, "fatal: %s\n", buffer);
+       vreportf("fatal: ", err, params);
        exit(0);
 }
 
@@ -648,6 +645,9 @@ int main(int argc, char **argv)
        setup_path();
        if (!enter_repo(dir, 0))
                not_found("Not a git repository: '%s'", dir);
+       if (!getenv("GIT_HTTP_EXPORT_ALL") &&
+           access("git-daemon-export-ok", F_OK) )
+               not_found("Repository not exported: '%s'", dir);
 
        git_config(http_config, NULL);
        cmd->imp(cmd_arg);