--- ufed.pl 2004-06-03 06:58:49.000000000 +0200 +++ /usr/sbin/ufed 2004-09-20 08:58:19.245728584 +0200 @@ -2,7 +2,7 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-src/ufed/ufed.pl,v 1.19 2004/06/03 04:58:49 fava Exp $ +# $Header: /home/cvsroot/gentoo-src/ufed/ufed.pl,v 1.18 2003/08/11 04:44:03 fava Exp $ # If you make ANY changes, please put them directly to the CVS log. The # ChangeLog file is generated automatically from that data. @@ -510,24 +510,36 @@ # the associated flag is emabled my ($flag, $package); my @flags; - open(FILE, '/etc/make.profile/use.defaults') or die ('couldn\'t open ' . "use.defaults"); + my $path = readlink '/etc/make.profile'; + my $tmppath; + $path =~ s!..!!; #FIXME sanitizie the path better + my @items = split /\//, $path ; + + #open(FILE, '/etc/make.profile/use.defaults') or die ('couldn\'t open ' . "use.defaults"); - while () + while (@items) { - s!#.*!!; - ($flag, $package) = split (m![\t ]+!); - $flag =~ s![ \t]!!g; - $package =~ s![ \t]!!g; - chomp($package); - - if ((defined($package)) and my_glob("/var/db/pkg/$package")) + $tmppath = join '/', @items ; + pop @items; + if (open(FILE,$tmppath . 'use.defaults' )) { + while () + { + s!#.*!!; + ($flag, $package) = split (m![\t ]+!); + $flag =~ s![ \t]!!g; + $package =~ s![ \t]!!g; + chomp($package); - #the package exists, therefore we add the use flag - push (@flags, $flag); + if ((defined($package)) and my_glob("/var/db/pkg/$package")) + { + #the package exists, therefore we add the use flag + push (@flags, $flag); + } + } } + close(FILE); } - close(FILE); return (@flags); }