aboutsummaryrefslogtreecommitdiff
path: root/shm.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-08-25 18:49:29 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-08-25 18:49:29 +0000
commit139f59c27d2f7f2fddef862408407f30107749b0 (patch)
treeff35ea47189229023254eca733b1a93d385e0953 /shm.c
parentMerge branch 'pedantic' into master (diff)
parentfix some buggy comparisons relating to signed/unsigned types (diff)
Merge branch 'type-limit-fixes' into master
Diffstat (limited to 'shm.c')
-rw-r--r--shm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/shm.c b/shm.c
index 2b2c3435..8a0a136d 100644
--- a/shm.c
+++ b/shm.c
@@ -131,10 +131,12 @@ page_size(void)
{
static size_t size = 0;
if (size == 0) {
- size = sysconf(_SC_PAGE_SIZE);
- if (size < 0) {
+ long n = sysconf(_SC_PAGE_SIZE);
+ if (n <= 0) {
LOG_ERRNO("failed to get page size");
size = 4096;
+ } else {
+ size = (size_t)n;
}
}
assert(size > 0);