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
tags/virt-backup-0.2.12-1
Daniel Berteaud 10 years ago
parent 207ad9eda9
commit cd8e2a5bef
  1. 5
      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;
}

Loading…
Cancel
Save