[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/06: c/binaries: Move lookup out of loop



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch merge-hardening-check
in repository lintian.

commit 42fb077e3836538a6143f56758953ffd4ffb5873
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Sep 17 19:09:27 2016 +0000

    c/binaries: Move lookup out of loop
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/binaries.pm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/checks/binaries.pm b/checks/binaries.pm
index ad90be8..4785bd0 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -106,8 +106,7 @@ sub run {
     my ($pkg, $type, $info, $proc, $group) = @_;
 
     my ($madir, %directories, $built_with_golang, %SONAME);
-    my $gnu_triplet_re;
-    my $ruby_triplet_re;
+    my ($arch_hardening, $gnu_triplet_re, $ruby_triplet_re);
     my $needs_libc = '';
     my $needs_libcxx = '';
     my $needs_libc_file;
@@ -123,6 +122,9 @@ sub run {
     my $multiarch = $info->field('multi-arch', 'no');
     my $srcpkg = $proc->pkg_src;
 
+    $arch_hardening = $HARDENING->value($arch)
+      if $arch ne 'all';
+
     foreach my $file (sort keys %{$info->objdump_info}) {
         my $objdump = $info->objdump_info->{$file};
         my $has_lfs;
@@ -556,8 +558,7 @@ sub run {
             # handles the following checks:
             # no-relro no-fortify-functions no-stackprotector no-bindnow no-pie
             if (exists($info->hardening_info->{$fname})) {
-                my $flags = $HARDENING->value($arch);
-                if ($flags) {
+                if ($arch_hardening) {
                     foreach my $t (@{$info->hardening_info->{$fname}}) {
                         my $tag = "hardening-$t";
                         # Binaries built by the Go compiler do not support all
@@ -566,7 +567,7 @@ sub run {
                           if ($t eq 'no-relro'
                             ||$t eq 'no-fortify-functions')
                           &&$built_with_golang;
-                        tag $tag, $file if $flags->{$tag};
+                        tag $tag, $file if $arch_hardening->{$tag};
                     }
                 }
             }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: