Correctly handle mmap() failure (#21062)

This commit is contained in:
Serge van den Boom 2009-04-05 19:00:18 -04:00 committed by Behdad Esfahbod
parent 35c5181151
commit 1dd95fcb8b
1 changed files with 2 additions and 0 deletions

View File

@ -553,6 +553,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
{ {
#if defined(HAVE_MMAP) || defined(__CYGWIN__) #if defined(HAVE_MMAP) || defined(__CYGWIN__)
cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0); cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0);
if (cache == MAP_FAILED)
cache = NULL;
#elif defined(_WIN32) #elif defined(_WIN32)
{ {
HANDLE hFileMap; HANDLE hFileMap;