]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Return or exit after done serving request
authorJakub Narebski <redacted>
Sun, 13 Jun 2010 10:09:32 +0000 (12:09 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:28 +0000 (00:51 -0400)
Check if there is a caller in top frame of gitweb, and either 'return'
if gitweb code is wrapped in subroutine, or 'exit' if it is not.

This should avoid

  gitweb.cgi: Subroutine git_SOMETHING redefined at gitweb.cgi line NNN

warnings in error_log when running gitweb with mod_perl (using
ModPerl::Registry handler)

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 0ca1f7cd8a52505d9776bc52cea5918c9c23a73a4c48909726b36c6093f5a9cc..d3aa80fc318e7254723010c60d8f23e2e77f96c7fc39694c02b39905e5a14659 100755 (executable)
@@ -1110,6 +1110,15 @@ sub run {
 
 run();
 
 
 run();
 
+if (defined caller) {
+       # wrapped in a subroutine processing requests,
+       # e.g. mod_perl with ModPerl::Registry, or PSGI with Plack::App::WrapCGI
+       return;
+} else {
+       # pure CGI script, serving single request
+       exit;
+}
+
 ## ======================================================================
 ## action links
 
 ## ======================================================================
 ## action links
 
This page took 0.209641 seconds and 4 git commands to generate.