core: in execute, Never fail setting Nice priority

Instead, push to the closest possible Nice priority setting.

Replaces: #11397
This commit is contained in:
Dimitri John Ledkov
2020-01-02 20:50:14 +01:00
committed by Lennart Poettering
parent 6bbeef2042
commit 390902012c
3 changed files with 64 additions and 5 deletions
+5 -5
View File
@@ -3236,11 +3236,11 @@ static int exec_child(
}
}
if (context->nice_set)
if (setpriority(PRIO_PROCESS, 0, context->nice) < 0) {
*exit_status = EXIT_NICE;
return log_unit_error_errno(unit, errno, "Failed to set up process scheduling priority (nice level): %m");
}
if (context->nice_set) {
r = setpriority_closest(context->nice);
if (r < 0)
return log_unit_error_errno(unit, r, "Failed to set up process scheduling priority (nice level): %m");
}
if (context->cpu_sched_set) {
struct sched_param param = {