summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-08-15 16:06:44 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-08-15 16:06:44 +0200
commit4c570696f7353841f3e781ea9df86825ff7108ec (patch)
treead761f1af48ca99fd2c9bf5efd79085ff365c7ef
parent8978311d518e93e4d4eb22914bc49776ac4d455b (diff)
downloadbin-4c570696f7353841f3e781ea9df86825ff7108ec.tar.gz
bin-4c570696f7353841f3e781ea9df86825ff7108ec.tar.xz
borg-restore.pl: Fix remove_tree not honoring prior chdir()
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xborg-restore.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/borg-restore.pl b/borg-restore.pl
index 6f63de7..5f027a3 100755
--- a/borg-restore.pl
+++ b/borg-restore.pl
@@ -265,7 +265,6 @@ sub restore {
printf "Restoring %s to %s from archive %s\n", $path, $destination, $archive->{archive};
my $basename = basename($path);
- my $final_destination = abs_path($basename);
my $components_to_strip =()= $path =~ /\//g;
debug(sprintf("CWD is %s", getcwd()));
@@ -273,6 +272,7 @@ sub restore {
mkdir($destination) unless -d $destination;
chdir($destination) or die "Failed to chdir: $!";
+ my $final_destination = abs_path($basename);
$final_destination = untaint($final_destination, qr(.*));
debug("Removing ".$final_destination);
File::Path::remove_tree($final_destination);