From: Kyle J. McKay Date: Sat, 25 Jun 2022 23:24:50 +0000 (-0700) Subject: projtool.pl: do not attempt to check unset error codes X-Git-Url: https://repo.or.cz/w/girocco.git/commitdiff_plain/HEAD projtool.pl: do not attempt to check unset error codes The "do" function only sets an error code when it fails. Attempting to clear the errors first could work, but only if the item being "do"'d does not ever cause them to be set. In this case the item has been set up to execute a "1" as its last value which means there should not be any ambiguity between the item returning "undef" as its final value and a failure causing "do" to return "undef". Check to see whether or not the "do" function has returned "undef" before testing any of the error result code variables. --- diff --git a/toolbox/projtool.pl b/toolbox/projtool.pl index ca90696..c313627 100755 --- a/toolbox/projtool.pl +++ b/toolbox/projtool.pl @@ -1411,9 +1411,10 @@ sub cmd_urls { @Gitweb::Config::git_base_mirror_urls = (); { package Gitweb::Config; - do $Girocco::Config::basedir."/gitweb/gitweb_config.perl"; - !$! or die "could not read gitweb_config.perl: $!\n"; - !$@ or die "could not parse gitweb_config.perl: $@\n"; + if (!defined(do $Girocco::Config::basedir."/gitweb/gitweb_config.perl")) { + !$! or die "could not read gitweb_config.perl: $!\n"; + !$@ or die "could not parse gitweb_config.perl: $@\n"; + } } my @fetch_urls = (); my @push_urls = ();