aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-04-10 22:04:27 +0300
committerLasse Collin <lasse.collin@tukaani.org>2024-04-10 23:12:23 +0300
commitfc43cecd32bf9d5f8caa599206b15c9569af1eb6 (patch)
treee9078dcad290919e453872f265134be333ebb492
parentliblzma: ARM64 CRC32: Add error checking to FreeBSD-specific code (diff)
downloadxz-fc43cecd32bf9d5f8caa599206b15c9569af1eb6.tar.xz
liblzma: ARM64 CRC32: Change style of the macOS code to match FreeBSD
I didn't test this but it shouldn't change any functionality. Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
-rw-r--r--src/liblzma/check/crc32_arm64.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/liblzma/check/crc32_arm64.h b/src/liblzma/check/crc32_arm64.h
index 68e7fcdd..39c1c63e 100644
--- a/src/liblzma/check/crc32_arm64.h
+++ b/src/liblzma/check/crc32_arm64.h
@@ -101,10 +101,11 @@ is_arch_extension_supported(void)
// CPU feature it tests. The Apple documentation lists the string
// "hw.optional.armv8_crc32", which can be found here:
// https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics#3915619
- int err = sysctlbyname("hw.optional.armv8_crc32", &has_crc32,
- &size, NULL, 0);
+ if (sysctlbyname("hw.optional.armv8_crc32", &has_crc32,
+ &size, NULL, 0) != 0)
+ return false;
- return !err && has_crc32;
+ return has_crc32;
#else
// If a runtime detection method cannot be found, then this must