From 16cec0f6d48a6acbb7cf4d702758ee8f4bfadc91 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 25 Jul 2021 13:32:27 +0200 Subject: [PATCH] btrbk: tidy map relative subvol argument --- btrbk | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/btrbk b/btrbk index f7fdf55..5ed6312 100755 --- a/btrbk +++ b/btrbk @@ -5601,18 +5601,10 @@ MAIN: # input validation foreach (@subvol_args) { 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 - $url_prefix = ""; - if(-d $_) { - $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; + if((-d $_) && ($_ =~ /^(.*)$/)) { # untaint ANY argument! + $path = check_file(`readlink -f -q '$1'`, { absolute => 1 }) } } unless(defined($path)) {