[glib: 3/25] Fix signedness in glib/gmappedfile.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 3/25] Fix signedness in glib/gmappedfile.c
- Date: Tue, 19 Mar 2019 11:03:06 +0000 (UTC)
commit 8eae303da02e51d846f8aad53ee9eb40eb19dc10
Author: Emmanuel Fleury <emmanuel fleury u-bordeaux fr>
Date: Fri Feb 1 20:46:10 2019 +0100
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)
^
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]