diff options
Diffstat (limited to 'rts/posix')
-rw-r--r-- | rts/posix/OSMem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index 6bec6b8602..4e5c5c170f 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -546,10 +546,12 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len) #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H) struct rlimit limit; + /* rlim_t is signed on some platforms, including FreeBSD; + * explicitly cast to avoid sign compare error */ if (!getrlimit(RLIMIT_AS, &limit) && limit.rlim_cur > 0 - && *len > limit.rlim_cur) { - *len = limit.rlim_cur; + && *len > (unsigned) limit.rlim_cur) { + *len = (unsigned) limit.rlim_cur; } #endif |