Commit 6a491726 authored by Fraser Tweedale's avatar Fraser Tweedale Committed by Marge Bot
Browse files

osReserveHeapMemory: handle signed rlim_t

rlim_t is a signed type on FreeBSD, and the build fails with a
sign-compare error.  Add explicit (unsigned) cast to handle this
case.
parent 1959bad3
Pipeline #5190 passed with stages
in 272 minutes and 31 seconds
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment