summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Eden <seden@havi.de>2015-02-11 10:03:22 +0100
committerSven Eden <seden@havi.de>2015-02-11 10:03:22 +0100
commit7816796df99454603bd978dc1ea15d7a5b6abd9a (patch)
tree5ef2dfd5cdf209feccdd778d99343ee368b6c2ed
parentPortage.pm : Enhanced eix detection code and added an optional debug message ... (diff)
downloadufed-7816796df99454603bd978dc1ea15d7a5b6abd9a.tar.gz
ufed-7816796df99454603bd978dc1ea15d7a5b6abd9a.tar.bz2
ufed-7816796df99454603bd978dc1ea15d7a5b6abd9a.zip
Portage.pm: Fixed a possible "Use of uninitialized value" if a read file is empty. (Bug #539682)
-rw-r--r--Portage.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/Portage.pm b/Portage.pm
index 534de52..d90be5e 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -418,7 +418,8 @@ sub _determine_profiles
@_profiles = -l $mp_path ? _norm_path('/etc', $mp) : $mp;
for (my $i = -1; $i >= -@_profiles; $i--) {
for(_noncomments("${_profiles[$i]}/parent")) {
- splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_));
+ length($_)
+ and splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_));
}
}
return;
@@ -723,9 +724,10 @@ sub _noncomments {
local $/;
if(open my $file, '<', $fname) {
binmode( $file, ":encoding(UTF-8)" );
- @result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n";
- shift @result if @result>0 && $result[0] eq '';
+ my $content = <$file> || "";
close $file;
+ @result = split /(?:[^\S\n]*(?:#.*)?\n)+/, "$content\n";
+ shift @result while ( (@result > 0) && !length($result[0]) );
}
}
@@ -766,7 +768,8 @@ sub _read_archs {
for my $dir(@_profiles) {
next unless (-r "$dir/arch.list");
for my $arch (_noncomments("$dir/arch.list")) {
- defined($_use_temp->{$arch})
+ length($arch)
+ and defined($_use_temp->{$arch})
and delete($_use_temp->{$arch});
}
}