summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-09-11 18:17:51 +0000
committerTed Kremenek <kremenek@apple.com>2008-09-11 18:17:51 +0000
commit81ced5c472d1e07fdfe4b3a8b7d5272fedc5f0ba (patch)
treef96a51aec6cef017d5315ba8af9831b04da2a10b
parentc4488441da327b976a369c1d19ae002b6eaf387b (diff)
downloadbcm5719-llvm-81ced5c472d1e07fdfe4b3a8b7d5272fedc5f0ba.tar.gz
bcm5719-llvm-81ced5c472d1e07fdfe4b3a8b7d5272fedc5f0ba.zip
Check if the environment variable TERM is defined before using it.
This fixes: <rdar://problem/6164279> scan-build gives error when invoked without TERM variable llvm-svn: 56110
-rwxr-xr-xclang/utils/scan-build5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/utils/scan-build b/clang/utils/scan-build
index 908795e281a..e0d53ad93dc 100755
--- a/clang/utils/scan-build
+++ b/clang/utils/scan-build
@@ -26,8 +26,9 @@ my $BuildName;
my $BuildDate;
my $CXX; # Leave undefined initially.
-my $UseColor = ((($ENV{'TERM'} eq 'xterm-color') and -t STDOUT)
- and defined($ENV{'SCAN_BUILD_COLOR'}));
+my $TERM = $ENV{'TERM'};
+my $UseColor = (defined $TERM and $TERM eq 'xterm-color' and -t STDOUT
+ and defined $ENV{'SCAN_BUILD_COLOR'});
##----------------------------------------------------------------------------##
# Diagnostics
OpenPOWER on IntegriCloud