]> Sergey Matveev's repositories - public-inbox.git/commitdiff
config: urlmatch $? does not influence our exits
authorEric Wong <e@80x24.org>
Wed, 23 Nov 2022 04:09:57 +0000 (04:09 +0000)
committerEric Wong <e@80x24.org>
Wed, 23 Nov 2022 10:51:24 +0000 (10:51 +0000)
We don't want to leak $? from `git config' failures into
lei nor public-inbox-* processes.

lib/PublicInbox/Config.pm

index c27928deddb7f1a5df17f2efe358719a64e47aba..6a51226e7d11777e64e420312404a698fac838a5 100644 (file)
@@ -544,11 +544,12 @@ sub urlmatch {
        my $val = <$fh>;
        if (close($fh)) {
                chomp($val);
-               $val;
        } else {
                $urlmatch_broken = 1 if (($? >> 8) != 1);
-               undef;
+               undef $val;
        }
+       $? = 0; # don't influence lei exit status
+       $val;
 }
 
 sub json {