summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm/args.pm18
1 files changed, 16 insertions, 2 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index 3f2a9a69..b6aa04a6 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -126,7 +126,14 @@ my %options_spec = (
'norebuild!' => sub { $urpm->{options}{norebuild} = $_[1] },
'test!' => \$::test,
'skip=s' => \$options{skip},
- 'root=s' => sub { require File::Spec; $::root = File::Spec->rel2abs($_[1]); $::nolock = 1 },
+ 'root=s' => sub {
+ require File::Spec;
+ $::root = File::Spec->rel2abs($_[1]);
+ if (!-d $::root) {
+ $urpm->{fatal}->(9, N("chroot directory doesn't exist"));
+ }
+ $::nolock = 1;
+ },
'use-distrib=s' => \$::usedistrib,
'excludepath|exclude-path=s' => sub { $urpm->{options}{excludepath} = $_[1] },
'excludedocs|exclude-docs' => sub { $urpm->{options}{excludedocs} = 1 },
@@ -228,7 +235,14 @@ my %options_spec = (
sources => \$options{sources},
force => \$options{force},
'skip=s' => \$options{skip},
- 'root=s' => sub { require File::Spec; $options{root} = File::Spec->rel2abs($_[1]); $options{nolock} = 1 },
+ 'root=s' => sub {
+ require File::Spec;
+ $options{root} = File::Spec->rel2abs($_[1]);
+ if (!-d $options{root}) {
+ $urpm->{fatal}->(9, N("chroot directory doesn't exist"));
+ }
+ $options{nolock} = 1;
+ },
'use-distrib=s' => sub {
if ($< != 0) {
print STDERR N("You need to be root to use --use-distrib"), "\n";