35 lines
922 B
Diff
35 lines
922 B
Diff
From 23ea15715c90bb3e85fd0392d7e1c7b2e94a3898 Mon Sep 17 00:00:00 2001
|
|
From: Juan RP <xtraeme@gmail.com>
|
|
Date: Sun, 11 Jan 2015 17:08:46 +0100
|
|
Subject: [PATCH] prop_object: check sysconf() return value.
|
|
|
|
Merged from xbps.
|
|
---
|
|
src/prop_object.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git src/prop_object.c src/prop_object.c
|
|
index a94015d..27f54b1 100644
|
|
--- src/prop_object.c
|
|
+++ src/prop_object.c
|
|
@@ -903,11 +903,17 @@ _prop_object_internalize_map_file(const char *fname)
|
|
{
|
|
struct stat sb;
|
|
struct _prop_object_internalize_mapped_file *mf;
|
|
- size_t pgsize = (size_t)sysconf(_SC_PAGESIZE);
|
|
- size_t pgmask = pgsize - 1;
|
|
+ long scps = sysconf(_SC_PAGESIZE);
|
|
+ size_t pgsize, pgmask;
|
|
bool need_guard = false;
|
|
int fd;
|
|
|
|
+ if (scps == -1)
|
|
+ return NULL;
|
|
+
|
|
+ pgsize = (size_t)scps;
|
|
+ pgmask = pgsize -1;
|
|
+
|
|
mf = _PROP_MALLOC(sizeof(*mf), M_TEMP);
|
|
if (mf == NULL)
|
|
return (NULL);
|