X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Debian%2FDgit.pm;h=ba1c28801aba0acb77fced48bb8966a878dc8973;hb=3ab98ee1228e40e8de5aba0e6a0f813625572078;hp=be8cbeea2a8667a69e6f0c54a4b9bacc2ffad94a;hpb=68d88a087c25d9e1cee7106938ab4e9751cfa146;p=dgit.git diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index be8cbeea..ba1c2880 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -36,7 +36,7 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); - @EXPORT = qw(setup_sigwarn + @EXPORT = qw(setup_sigwarn forkcheck_setup forkcheck_mainprocess dep14_version_mangle debiantags debiantag_old debiantag_new server_branch server_ref @@ -81,10 +81,21 @@ sub NOCOMMITCHECK () { return 0x8; } our $debugprefix; our $debuglevel = 0; +our $forkcheck_mainprocess; + +sub forkcheck_setup () { + $forkcheck_mainprocess = $$; +} + +sub forkcheck_mainprocess () { + # You must have called forkcheck_setup or setup_sigwarn already + getppid != $forkcheck_mainprocess; +} + sub setup_sigwarn () { - our $sigwarn_mainprocess = $$; + forkcheck_setup(); $SIG{__WARN__} = sub { - die $_[0] unless getppid == $sigwarn_mainprocess; + die $_[0] if forkcheck_mainprocess; }; } @@ -126,6 +137,7 @@ sub messagequote ($) { sub shellquote { my @out; local $_; + defined or confess 'internal error' foreach @_; foreach my $a (@_) { $_ = $a; if (!length || m{[^-=_./:0-9a-z]}i) {