summaryrefslogtreecommitdiff
path: root/rts/posix
diff options
context:
space:
mode:
authorFraser Tweedale <frase@frase.id.au>2019-04-08 17:27:06 +1000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-23 09:27:30 -0400
commit6a491726bbe000c4b0effc4175caaaabc7416f1e (patch)
treece102819ef7c530b68916564249a15621722e2e1 /rts/posix
parent1959bad3feb9a05c8a5f2a4249a2506c5770d6fe (diff)
downloadhaskell-6a491726bbe000c4b0effc4175caaaabc7416f1e.tar.gz
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.
Diffstat (limited to 'rts/posix')
-rw-r--r--rts/posix/OSMem.c6
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