X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fblhc;h=993b3e751114109cd10b8f7f51b5063de4f4bf06;hb=c210cea572fd379f569260fcfee0fb85d56800ec;hp=585df64686548a44b699b8a8abbd8221ef449ffb;hpb=0a47fe3860b5c7aecbb60760010b69a28ef460ff;p=blhc%2Fblhc.git diff --git a/bin/blhc b/bin/blhc index 585df64..993b3e7 100755 --- a/bin/blhc +++ b/bin/blhc @@ -27,6 +27,50 @@ use Term::ANSIColor (); our $VERSION = '0.01'; +# CONSTANTS/VARIABLES + +# Regex to catch compiler commands. +my $cc_regex = qr/(?:x86_64-linux-gnu-)?(?:(? '-Wl,-z,relro', + '-Wl,(-z,)?now' => '-Wl,-z,now', +); + + # FUNCTIONS sub error_flags { @@ -152,50 +196,6 @@ sub is_non_verbose_build { } -# CONSTANTS/VARIABLES - -# Regex to catch compiler commands. -my $cc_regex = qr/(?:x86_64-linux-gnu-)?(?:(? '-Wl,-z,relro', - '-Wl,(-z,)?now' => '-Wl,-z,now', -); - - # MAIN # Additional hardening options. @@ -250,8 +250,14 @@ my $exit = 0; # Input lines, contain only the lines with compiler commands. my @input = (); +my $start = 0; my $continuation = 0; while (my $line = <>) { + # We skip over unimportant lines at the beginning to prevent false + # positives. + $start = 1 if $line =~ /^dpkg-buildpackage:/; + next if not $start; + # Ignore compiler warnings for now. next if $line =~ /$warning_regex/;