From 8eae303da02e51d846f8aad53ee9eb40eb19dc10 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 1 Feb 2019 20:46:10 +0100 Subject: [PATCH] Fix signedness in glib/gmappedfile.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) ^ --- glib/gmappedfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gmappedfile.c b/glib/gmappedfile.c index d180a9a4d..36e7ca5a8 100644 --- a/glib/gmappedfile.c +++ b/glib/gmappedfile.c @@ -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; }