Fix signedness in glib/gmappedfile.c

glib/gmappedfile.c: In function ‘mapped_file_new_from_fd’:
glib/gmappedfile.c:153:18: error: comparison of integer expressions of different signedness: ‘__off_t’ {aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare]
   if (st.st_size > G_MAXSIZE)
                  ^
This commit is contained in:
Emmanuel Fleury 2019-02-01 20:46:10 +01:00
parent 2f9e6e977a
commit 8eae303da0

View File

@ -150,7 +150,7 @@ mapped_file_new_from_fd (int fd,
file->contents = MAP_FAILED;
#ifdef HAVE_MMAP
if (st.st_size > G_MAXSIZE)
if (sizeof (st.st_size) > sizeof (gsize) && st.st_size > (off_t) G_MAXSIZE)
{
errno = EINVAL;
}