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 <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Abhijit Menon-Sen 2008-08-04 17:08:27 +05:30 коммит произвёл Junio C Hamano
Родитель c72e0db1ff
Коммит 108c2aaf79
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -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) {