From 0deeae164c4db3f0f6edda636adba5a3b2f4a1e0 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 25 Jun 2022 16:24:50 -0700 Subject: [PATCH] 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. --- toolbox/projtool.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 = (); -- 2.11.4.GIT