aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-03 18:50:04 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-03 18:50:04 +0200
commitacd217aa4241a973fcc5605f31a364af66049f32 (patch)
tree3d384499c32bf9b295a02cac71ad8137792405e2
parentc6853cefe4b0de30d3fb04d7be8a0a78a23d51d3 (diff)
Use 4 KiB blocks if sysconf(_SC_PAGESIZE) fails
-rw-r--r--lib/alloc/arena_alloc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/alloc/arena_alloc.c b/lib/alloc/arena_alloc.c
index d953423..965c6a7 100644
--- a/lib/alloc/arena_alloc.c
+++ b/lib/alloc/arena_alloc.c
@@ -60,9 +60,7 @@ alloc(allocator_t mem, ptrdiff_t nmemb, ptrdiff_t elemsz, ptrdiff_t align)
arena_ctx_t *ctx = mem.ctx;
if (ctx->blksz == 0) {
long blksz = sysconf(_SC_PAGESIZE);
- if (blksz == -1)
- errjmp(mem.err);
- ctx->blksz = blksz;
+ ctx->blksz = blksz == -1 ? 4096 : blksz;
}
ptrdiff_t bufsz;