aboutsummaryrefslogtreecommitdiff
path: root/src/common/physmem.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-09-05 01:20:29 +0300
committerLasse Collin <lasse.collin@tukaani.org>2009-09-05 01:20:29 +0300
commit60ccb80c9c4a0d771acc5b7d9d6f32b17fed1071 (patch)
tree7b769ed2608f10e82dce96e82115bfa0d4db11fb /src/common/physmem.h
parentMention in INSTALL that --enable-small doesn't modify CFLAGS. (diff)
downloadxz-60ccb80c9c4a0d771acc5b7d9d6f32b17fed1071.tar.xz
Use sysctl() != -1 instead of !sysctl() to check if
the function call succeeded. NetBSD 4.0 returns positive values on success, but NetBSD Current and FreeBSD return zero. OpenBSD's man page doesn't tell what sysctl() returns on success. All these BSDs return -1 on error. Thanks to Robert Elz and Thomas Klausner.
Diffstat (limited to '')
-rw-r--r--src/common/physmem.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/physmem.h b/src/common/physmem.h
index 0dc77e97..74ea39e3 100644
--- a/src/common/physmem.h
+++ b/src/common/physmem.h
@@ -104,7 +104,7 @@ physmem(void)
uint64_t u64;
} mem;
size_t mem_ptr_size = sizeof(mem.u64);
- if (!sysctl(name, 2, &mem.u64, &mem_ptr_size, NULL, 0)) {
+ if (sysctl(name, 2, &mem.u64, &mem_ptr_size, NULL, 0) != -1) {
// IIRC, 64-bit "return value" is possible on some 64-bit
// BSD systems even with HW_PHYSMEM (instead of HW_PHYSMEM64),
// so support both.