mirror of https://github.com/digint/btrbk
btrbk: tidy map relative subvol argument
parent
2824668c0e
commit
16cec0f6d4
14
btrbk
14
btrbk
|
@ -5601,18 +5601,10 @@ 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) {
|
if(!defined($path) && $subvol_args_allow_relative && ($url_prefix eq "")) {
|
||||||
# map relative path to absolute
|
# map relative path to absolute
|
||||||
$url_prefix = "";
|
if((-d $_) && ($_ =~ /^(.*)$/)) { # untaint ANY argument!
|
||||||
if(-d $_) {
|
$path = check_file(`readlink -f -q '$1'`, { absolute => 1 })
|
||||||
$path = $1 if($_ =~ /^(.*)$/); # untaint ANY argument, real check below
|
|
||||||
$path = `readlink -f -q '$path'` if(defined($path));
|
|
||||||
$path = check_file($path, { absolute => 1 });
|
|
||||||
}
|
|
||||||
unless(defined($path)) {
|
|
||||||
ERROR "Bad argument: not a valid path: $_";
|
|
||||||
HELP_MESSAGE(0);
|
|
||||||
exit 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unless(defined($path)) {
|
unless(defined($path)) {
|
||||||
|
|
Loading…
Reference in New Issue