mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-10-24 17:21:49 +00:00
Handle errors when getting SC_PAGESIZE
Signed-off-by: Jan Friesse <jfriesse@redhat.com> Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
This commit is contained in:
parent
56ee492471
commit
c264eb3be9
@ -736,6 +736,7 @@ memory_map (char *path, const char *file, void **buf, size_t bytes)
|
||||
int32_t i;
|
||||
size_t written;
|
||||
size_t page_size;
|
||||
long int sysconf_page_size;
|
||||
|
||||
snprintf (path, PATH_MAX, "/dev/shm/%s", file);
|
||||
|
||||
@ -752,7 +753,11 @@ memory_map (char *path, const char *file, void **buf, size_t bytes)
|
||||
if (res == -1) {
|
||||
goto error_close_unlink;
|
||||
}
|
||||
page_size = (size_t)sysconf(_SC_PAGESIZE);
|
||||
sysconf_page_size = sysconf(_SC_PAGESIZE);
|
||||
if (sysconf_page_size <= 0) {
|
||||
goto error_close_unlink;
|
||||
}
|
||||
page_size = sysconf_page_size;
|
||||
buffer = malloc (page_size);
|
||||
if (buffer == NULL) {
|
||||
goto error_close_unlink;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user