headers_install: check exit status of unifdef

If unifdef fails for any reason (like segfaulting), we should be aborting
the install steps.  So check its exit status in this unlikely scenario.

Reported-by: Diego Elio Pettenò <flameeyes@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
Mike Frysinger 2010-11-23 19:54:02 -05:00 committed by Michal Marek
parent 43f901fbc8
commit 2979076fbf

View file

@ -45,6 +45,13 @@ foreach my $file (@files) {
close $in; close $in;
system $unifdef . " $tmpfile > $installdir/$file"; system $unifdef . " $tmpfile > $installdir/$file";
# unifdef will exit 0 on success, and will exit 1 when the
# file was processed successfully but no changes were made,
# so abort only when it's higher than that.
my $e = $? >> 8;
if ($e > 1) {
die "$tmpfile: $!\n";
}
unlink $tmpfile; unlink $tmpfile;
} }
exit 0; exit 0;