From 02e14506ac57f50b8fe77c79ae72be0403d52b2c Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Tue, 29 Jan 2008 21:34:54 +0000 Subject: sanitize usage and test of buildroot env var --- compress_files | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'compress_files') diff --git a/compress_files b/compress_files index dffbc63..15249fa 100755 --- a/compress_files +++ b/compress_files @@ -100,8 +100,10 @@ sub find_so_man() { my $ext = $ARGV[0] ||= '.gz'; die "Unknown extension $ext" unless $ext =~ /^\.(?:gz|bz2|lzma)$/; -my $RPM_BUILD_ROOT = $ENV{RPM_BUILD_ROOT}; -chdir($RPM_BUILD_ROOT) or die "Can't cd to $ENV{RPM_BUILD_ROOT}: $!"; +my $buildroot = $ENV{RPM_BUILD_ROOT}; +die "No build root defined" unless $buildroot; +die "Invalid build root" unless -d $buildroot; +chdir($buildroot) or die "Can't cd to $buildroot: $!"; # Now the .so conversion. @sofiles = @sodests = (); @@ -204,7 +206,7 @@ foreach (keys %hardlinks) { # Fix up symlinks that were pointing to the uncompressed files. my $FIND; -open($FIND, "find $RPM_BUILD_ROOT -type l |"); +open($FIND, "find $buildroot -type l |"); while (<$FIND>) { local $_ = $_; chomp; -- cgit v1.2.1