summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-02-18 19:33:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-02-18 19:33:24 +0000
commitb8fa5fa2b0072ebd19528bb0522553499ee948d4 (patch)
tree49213c006255ad0a1d310b63611b27b6c5493dc3
parent4fdeacdeb33a31e3e6f2aadb12ec5c4e505ad523 (diff)
downloaddrakx-b8fa5fa2b0072ebd19528bb0522553499ee948d4.tar
drakx-b8fa5fa2b0072ebd19528bb0522553499ee948d4.tar.gz
drakx-b8fa5fa2b0072ebd19528bb0522553499ee948d4.tar.bz2
drakx-b8fa5fa2b0072ebd19528bb0522553499ee948d4.tar.xz
drakx-b8fa5fa2b0072ebd19528bb0522553499ee948d4.zip
ensure the "range" entry returned value is bounded as asked
(useful for backends not handling "range" correctly, like interactive::newt) (bugzilla #13744)
-rw-r--r--perl-install/interactive.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 1d704112e..d577ded21 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -406,6 +406,13 @@ sub ask_from_real {
my ($o, $common, $l) = @_;
my ($l1, $l2) = partition { !$_->{advanced} } @$l;
my $v = $o->ask_fromW($common, $l1, $l2);
+
+ foreach my $e (@$l1, @$l2) {
+ if ($e->{type} eq 'range') {
+ ${$e->{val}} = max($e->{min}, min(${$e->{val}}, $e->{max}));
+ }
+ }
+
%$common = ();
$v;
}