summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/missing.h3
-rw-r--r--src/shared/util.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/missing.h b/src/shared/missing.h
index 06c69dac8e..4e63fb9ac4 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -47,6 +47,9 @@
#define RLIMIT_RTTIME 15
#endif
+/* If RLIMIT_RTTIME is not defined, then we cannot use RLIMIT_NLIMITS as is */
+#define _RLIMIT_MAX (RLIMIT_RTTIME+1 > RLIMIT_NLIMITS ? RLIMIT_RTTIME+1 : RLIMIT_NLIMITS)
+
#ifndef F_LINUX_SPECIFIC_BASE
#define F_LINUX_SPECIFIC_BASE 1024
#endif
diff --git a/src/shared/util.c b/src/shared/util.c
index 10daff3036..8c7cfbd6df 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -83,6 +83,7 @@
#include "gunicode.h"
#include "virt.h"
#include "def.h"
+#include "missing.h"
int saved_argc = 0;
char **saved_argv = NULL;
@@ -4713,7 +4714,7 @@ static const char* const sched_policy_table[] = {
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(sched_policy, int, INT_MAX);
-static const char* const rlimit_table[] = {
+static const char* const rlimit_table[_RLIMIT_MAX] = {
[RLIMIT_CPU] = "LimitCPU",
[RLIMIT_FSIZE] = "LimitFSIZE",
[RLIMIT_DATA] = "LimitDATA",