From cd8e2a5bef796da5ee8ceaee32f7b90c3d84cb45 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 10 Feb 2015 12:33:32 +0100 Subject: [PATCH] Convert backupdir to an absolute path Prevent cleanup faiklure if you use an relative path in combination with file based disks Issue reported by Diego --- virt-backup | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/virt-backup b/virt-backup index ff9345c..88cb5e5 100644 --- a/virt-backup +++ b/virt-backup @@ -27,6 +27,7 @@ use XML::Simple; use Sys::Virt; use Getopt::Long; use File::Copy; +use File::Spec; # Set umask umask(022); @@ -189,9 +190,11 @@ if (!$opts{offline} && !$opts{snapshot}){ exit 1; } +# Makes sur backupdir is an absolute path +$opts{backupdir} = File::Spec->rel2abs($opts{backupdir}, '/'); # Backup dir needs to be created first if (! -d $opts{backupdir} ){ - print "$opts{backupdir} is not a valid directory\n"; + print "$opts{backupdir} doesn't exist\n"; exit 1; }