summaryrefslogtreecommitdiff
path: root/modules/pam_limits/pam_limits.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pam_limits/pam_limits.c')
-rw-r--r--modules/pam_limits/pam_limits.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/pam_limits/pam_limits.c b/modules/pam_limits/pam_limits.c
index 5909cb28..520f2479 100644
--- a/modules/pam_limits/pam_limits.c
+++ b/modules/pam_limits/pam_limits.c
@@ -337,12 +337,19 @@ static void process_limit(int source, const char *lim_type,
_pam_log(LOG_DEBUG,"unknown limit type '%s'", lim_type);
return;
}
- if (limit_item != LIMIT_PRI && (strcmp(lim_value, "-1") == 0
+ if (limit_item != LIMIT_PRI
+#ifdef RLIMIT_NICE
+ && limit_item != RLIMIT_NICE
+#endif
+ && (strcmp(lim_value, "-1") == 0
|| strcmp(lim_value, "-") == 0 || strcmp(lim_value, "unlimited") == 0
|| strcmp(lim_value, "infinity") == 0)) {
int_value = -1;
rlimit_value = RLIM_INFINITY;
} else if (limit_item == LIMIT_PRI || limit_item == LIMIT_LOGIN ||
+#ifdef RLIMIT_NICE
+ limit_item == RLIMIT_NICE ||
+#endif
limit_item == LIMIT_NUMSYSLOGINS) {
long temp;
temp = strtol (lim_value, &endptr, 10);
@@ -385,6 +392,12 @@ static void process_limit(int source, const char *lim_type,
case RLIMIT_AS:
if (rlimit_value != RLIM_INFINITY)
rlimit_value *= 1024;
+#ifdef RLIMIT_NICE
+ case RLIMIT_NICE:
+ if (int_value > 19)
+ int_value = 19;
+ rlimit_value = 19 - int_value;
+#endif
break;
}