aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-07-22 17:29:50 -0700
committerChris Robinson <[email protected]>2022-07-22 17:29:50 -0700
commit1b28a24f6e917380536d882384aba388e331329e (patch)
treefea3a358a4a5a0a440c40161af306bfe40e8b737 /core
parent3f94e1c70aad4210f8a79683c41c3dd3538f0102 (diff)
Don't assume rlim_t is unsigned
Diffstat (limited to 'core')
-rw-r--r--core/helpers.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/helpers.cpp b/core/helpers.cpp
index 6d0863ca..dea7fdf5 100644
--- a/core/helpers.cpp
+++ b/core/helpers.cpp
@@ -497,11 +497,12 @@ bool SetRTPriorityRTKit(int prio)
if(getrlimit(RLIMIT_RTTIME, &rlim) != 0)
return errno;
- TRACE("RTTime max: %llu (hard: %llu, soft: %llu)\n", umaxtime, ulonglong{rlim.rlim_max},
- ulonglong{rlim.rlim_cur});
+ TRACE("RTTime max: %llu (hard: %llu, soft: %llu)\n", umaxtime,
+ static_cast<ulonglong>(rlim.rlim_max), static_cast<ulonglong>(rlim.rlim_cur));
if(rlim.rlim_max > umaxtime)
{
- rlim.rlim_max = static_cast<rlim_t>(umaxtime);
+ rlim.rlim_max = static_cast<rlim_t>(std::min<ulonglong>(umaxtime,
+ std::numeric_limits<rlim_t>::max()));
rlim.rlim_cur = std::min(rlim.rlim_cur, rlim.rlim_max);
if(setrlimit(RLIMIT_RTTIME, &rlim) != 0)
return errno;