提交 108c2aaf 编写于 作者: A Abhijit Menon-Sen 提交者: Junio C Hamano

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: NAbhijit Menon-Sen <ams@toroid.org>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c72e0db1
......@@ -417,6 +417,7 @@ sub command_bidi_pipe {
=cut
sub command_close_bidi_pipe {
local $?;
my ($pid, $in, $out, $ctx) = @_;
foreach my $fh ($in, $out) {
unless (close $fh) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册