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 --- clean_files | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clean_files') diff --git a/clean_files b/clean_files index 7e5d02d..2e7723e 100755 --- a/clean_files +++ b/clean_files @@ -14,9 +14,10 @@ use strict; use warnings; $ENV{DONT_CLEANUP} and exit(0); -my $RPM_BUILD_ROOT = $ENV{RPM_BUILD_ROOT}; -$RPM_BUILD_ROOT or exit(0); # case RPM_BUILD_ROOT is not used -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: $!"; system(split(/\s+/, "find . -type f -a ( -name #*# -o -name *~ -o -name DEADJOE -o -name .cvsignore -- cgit v1.2.1