From: John 'Warthog9' Hawley Date: Sat, 30 Jan 2010 22:30:41 +0000 (+0100) Subject: gitweb: Check that $site_header etc. are defined before using them X-Git-Tag: v1.7.0-rc2~22^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=24d4afcdc79cb250131841040b803401d261a473;p=git.git gitweb: Check that $site_header etc. are defined before using them If one of $site_header, $site_footer or $home_text is not defined, you get extraneous errors in the web logs, for example (line wrapped for better readibility): [Wed Jan 13 16:55:42 2010] [error] [client ::1] [Wed Jan 13 16:55:42 2010] gitweb.cgi: Use of uninitialized value $site_header in -f at /var/www/gitweb/gitweb.cgi line 3287., referer: http://git/gitweb.cgi This ensures that those variables are defined before trying to use it. Note that such error can happen only because of an error in gitweb config file; building gitweb.cgi can make mentioned variables holding empty string (it is even the default), but they are still defined. Signed-off-by: John 'Warthog9' Hawley Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index e2522cc64..a4148d36a 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3254,7 +3254,7 @@ EOF print "\n" . "\n"; - if (-f $site_header) { + if (defined $site_header && -f $site_header) { insert_file($site_header); } @@ -3355,7 +3355,7 @@ sub git_footer_html { print "\n"; # class="page_footer" } - if (-f $site_footer) { + if (defined $site_footer && -f $site_footer) { insert_file($site_footer); } @@ -4781,7 +4781,7 @@ sub git_project_list { } git_header_html(); - if (-f $home_text) { + if (defined $home_text && -f $home_text) { print "
\n"; insert_file($home_text); print "
\n";