mirror of https://github.com/digint/btrbk
btrbk: use File::Spec for relative file arguments
parent
eccb24ecd7
commit
5d94de9142
9
btrbk
9
btrbk
|
@ -5635,11 +5635,12 @@ MAIN:
|
||||||
# input validation
|
# input validation
|
||||||
foreach (@subvol_args) {
|
foreach (@subvol_args) {
|
||||||
my ($url_prefix, $path) = check_url($_);
|
my ($url_prefix, $path) = check_url($_);
|
||||||
if(!defined($path) && $subvol_args_allow_relative && ($url_prefix eq "")) {
|
if(!defined($path) && $subvol_args_allow_relative && ($url_prefix eq "") && (-d $_)) {
|
||||||
# map relative path to absolute
|
unless(eval_quiet { require File::Spec; }) {
|
||||||
if((-d $_) && ($_ =~ /^(.*)$/)) { # untaint ANY argument!
|
ERROR "Cannot handle relative paths (perl version too old; missing File::Spec module): $_";
|
||||||
$path = check_file(`readlink -f -q '$1'`, { absolute => 1 })
|
exit 2;
|
||||||
}
|
}
|
||||||
|
$path = check_file(File::Spec->rel2abs($_), { absolute => 1 });
|
||||||
}
|
}
|
||||||
unless(defined($path)) {
|
unless(defined($path)) {
|
||||||
ERROR "Bad argument: not a subvolume declaration: $_";
|
ERROR "Bad argument: not a subvolume declaration: $_";
|
||||||
|
|
Loading…
Reference in New Issue