diff options
-rw-r--r-- | base/file_util_posix.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 5c14abd..58cd732 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -927,7 +927,10 @@ bool DetermineDevShmExecutable() { if (fd >= 0) { ScopedFD shm_fd_closer(&fd); Delete(path, false); - size_t pagesize = sysconf(_SC_PAGESIZE); + long sysconf_result = sysconf(_SC_PAGESIZE); + CHECK_GE(sysconf_result, 0); + size_t pagesize = static_cast<size_t>(sysconf_result); + CHECK_GE(sizeof(pagesize), sizeof(sysconf_result)); void *mapping = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fd, 0); if (mapping != MAP_FAILED) { if (mprotect(mapping, pagesize, PROT_READ | PROT_EXEC) == 0) |