From: Abhijit Menon-Sen Date: Mon, 4 Aug 2008 11:38:27 +0000 (+0530) Subject: Git.pm: localise $? in command_close_bidi_pipe() X-Git-Tag: v1.6.0-rc2~25 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=108c2aaf7984081daa6aed6d3947c7c0952216c2;p=git.git Git.pm: localise $? in command_close_bidi_pipe() Git::DESTROY calls _close_cat_blob and _close_hash_and_insert_object, which in turn call command_close_bidi_pipe, which calls waitpid, which alters $?. If this happens during global destruction, it may alter the program's exit status unexpectedly. Making $? local to the function solves the problem. (The problem was discovered due to a failure of test #8 in t9106-git-svn-commit-diff-clobber.sh.) Signed-off-by: Abhijit Menon-Sen Signed-off-by: Junio C Hamano --- diff --git a/perl/Git.pm b/perl/Git.pm index 087d3d0e8..faaa19f62 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -417,6 +417,7 @@ have more complicated structure. =cut sub command_close_bidi_pipe { + local $?; my ($pid, $in, $out, $ctx) = @_; foreach my $fh ($in, $out) { unless (close $fh) {