Explorar el Código

coroipcc: Test _SC_PAGESIZE result

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
(cherry picked from commit 94d934e0e0fa55027a974eb709a488802ee6134e)
Jan Friesse hace 14 años
padre
commit
cc489e63f5
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      lib/coroipcc.c

+ 8 - 0
lib/coroipcc.c

@@ -309,6 +309,10 @@ circular_memory_map (char *path, const char *file, void **buf, size_t bytes)
 	}
 
 	page_size = sysconf(_SC_PAGESIZE);
+	if (page_size == -1) {
+		goto error_close_unlink;
+	}
+
 	buffer = malloc (page_size);
 	if (buffer == NULL) {
 		goto error_close_unlink;
@@ -415,6 +419,10 @@ memory_map (char *path, const char *file, void **buf, size_t bytes)
 		goto error_close_unlink;
 	}
 	page_size = sysconf(_SC_PAGESIZE);
+	if (page_size == -1) {
+		goto error_close_unlink;
+	}
+
 	buffer = malloc (page_size);
 	if (buffer == NULL) {
 		goto error_close_unlink;