From ab4ded98309dd1b63cf2b241cfcf5a40695d6ab1 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Mon, 7 Mar 2016 19:17:33 +0100 Subject: [PATCH] btrbk: ABORTED() now sets $abrt to last message (useful for warnings after abort) --- btrbk | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/btrbk b/btrbk index 5a1b31d..a7c5c7c 100755 --- a/btrbk +++ b/btrbk @@ -176,6 +176,7 @@ my $dryrun; my $loglevel = 1; my $show_progress = 0; my $err = ""; +my $abrt = ""; # last ABORTED() message my $output_format; my $tlog_fh; my $current_transaction; @@ -252,21 +253,21 @@ sub ERROR { my $t = shift; print STDERR "ERROR: $t\n"; } sub ABORTED($;$) { my $config = shift; - my $t = shift; + $abrt = shift; $config = $config->{CONFIG} unless($config->{CONTEXT}); - return $config->{ABORTED} unless(defined($t)); + return $config->{ABORTED} unless(defined($abrt)); - unless($t eq "USER_SKIP") { - $t =~ s/\n/\\\\/g; - $t =~ s/\r//g; + unless($abrt eq "USER_SKIP") { + $abrt =~ s/\n/\\\\/g; + $abrt =~ s/\r//g; action("abort_" . ($config->{CONTEXT} || "undef"), status => "ABORT", vinfo_prefixed_keys("target", vinfo($config->{url}, $config)), - message => $t, + message => $abrt, ); } - $config->{ABORTED} = $t; - return $t; + $abrt = 1 unless($abrt); # make sure $abrt is always a true value + $config->{ABORTED} = $abrt; }