--- ufed-0.40.1/ufed.pl.in 2009-10-27 00:09:56.000000000 +0100 +++ src/ufed.pl.in 2012-09-20 19:17:28.836135032 +0200 @@ -17,6 +17,11 @@ sub read_use_descs(); sub save_flags(@); +# Quit early if there is no valid make.conf found by Portage.pm +die "Could not determine the location of your make.conf.\n" + unless (defined($Portage::make_conf_path) + && length($Portage::make_conf_path)); + delete $Portage::all_flags{'*'}; read_use_descs; @@ -25,6 +30,7 @@ $Portage::make_conf_flags{'-*'} = 1 if defined $Portage::make_conf_flags{'*'} && !$Portage::make_conf_flags{'*'}; + for(keys %Portage::all_flags) { @{$use_descriptions{$_}} = "(Unknown)" if not exists $use_descriptions{$_}; @@ -155,10 +161,11 @@ my (@flags) = @_; my $contents; + my $mcFile = $Portage::make_conf_path; { - open my $makeconf, '<', '/etc/make.conf' or die "Couldn't open /etc/make.conf\n"; - open my $makeconfold, '>', '/etc/make.conf.old' or die "Couldn't open /etc/make.conf.old\n"; + open my $makeconf, '<', $mcFile or die "Couldn't open $mcFile\nReason: $!\n"; + open my $makeconfold, '>', "${mcFile}.old" or die "Couldn't open ${mcFile}.old\nReason: $!\n"; local $/; $_ = <$makeconf>; print $makeconfold $_; @@ -293,11 +300,11 @@ die "Parse error when writing make.conf - did you modify it while ufed was running?\n" if $@; print STDERR <', '/etc/make.conf' or die "Couldn't open /etc/make.conf\n"; + open my $makeconf, '>', $mcFile or die "Couldn't open $mcFile\nReason: $!\n"; print $makeconf $_; close $makeconf; }