1
0
forked from GitHub/gf-core

safe error reporting in case of mmap failure

This commit is contained in:
krangelov
2021-10-13 21:33:55 +02:00
parent 27f0ff14a3
commit 45ee985fda

View File

@@ -327,6 +327,7 @@ PgfDB::PgfDB(const char* filepath, int flags, int mode) {
ms = (malloc_state*)
mmap(NULL, file_size, PROT_READ | PROT_WRITE, mflags, fd, 0);
if (ms == MAP_FAILED) {
ms = NULL; // mark that ms is not created.
::free((void *) this->filepath);
int code = errno;
close(fd);