diff options
author | Tobin C. Harding <me@tobin.cc> | 2018-01-06 09:24:49 +1100 |
---|---|---|
committer | Tobin C. Harding <me@tobin.cc> | 2018-04-07 08:50:34 +1000 |
commit | 6efb7458280a8f5d4c1955324e9d8985e90a882b (patch) | |
tree | d73b113a0ac2fcb6da5c1bd2f831e336c7a93f0e | |
parent | 2f042c93a138f87a2f85e80daa5dbab6bf138045 (diff) | |
download | op-kernel-dev-6efb7458280a8f5d4c1955324e9d8985e90a882b.zip op-kernel-dev-6efb7458280a8f5d4c1955324e9d8985e90a882b.tar.gz |
leaking_addresses: use system command to get arch
Currently script uses Perl to get the machine architecture. This can be
erroneous since Perl uses the architecture of the machine that Perl was
compiled on not the architecture of the running machine. We should use
the systems `uname` command instead.
Use `uname -m` instead of Perl to get the machine architecture.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
-rwxr-xr-x | scripts/leaking_addresses.pl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl index 35d6dd9..56894da 100755 --- a/scripts/leaking_addresses.pl +++ b/scripts/leaking_addresses.pl @@ -142,10 +142,10 @@ if (!is_supported_architecture()) { foreach(@SUPPORTED_ARCHITECTURES) { printf "\t%s\n", $_; } + printf("\n"); - my $archname = $Config{archname}; - printf "\n\$ perl -MConfig -e \'print \"\$Config{archname}\\n\"\'\n"; - printf "%s\n", $archname; + my $archname = `uname -m`; + printf("Machine hardware name (`uname -m`): %s\n", $archname); exit(129); } @@ -172,7 +172,7 @@ sub is_supported_architecture sub is_x86_64 { - my $archname = $Config{archname}; + my $archname = `uname -m`; if ($archname =~ m/x86_64/) { return 1; @@ -182,9 +182,9 @@ sub is_x86_64 sub is_ppc64 { - my $archname = $Config{archname}; + my $archname = `uname -m`; - if ($archname =~ m/powerpc/ and $archname =~ m/64/) { + if ($archname =~ m/ppc64/) { return 1; } return 0; |