Skip to content

Commit

Permalink
lib: Avoid compiler warning if off_t has the same size as ssize_t.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Aug 15, 2016
1 parent caefe52 commit 9d9be93
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/mmap-util.c
Expand Up @@ -12,11 +12,13 @@ void *mmap_file(int fd, size_t *length, int prot)
if (fstat(fd, &st) < 0)
return MAP_FAILED;

#if OFF_T_MAX > SSIZE_T_MAX
if (st.st_size > SSIZE_T_MAX) {
/* too large file to map into memory */
errno = EFBIG;
return MAP_FAILED;
}
#endif

*length = (size_t)st.st_size;
if (*length == 0)
Expand Down

0 comments on commit 9d9be93

Please sign in to comment.