core: in execute, soft fail setting Nice priority, when permissions a… #6503

Open
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+9 −2
Split
View
@@ -2509,11 +2509,18 @@ static int exec_child(
}
}
- if (context->nice_set)
- if (setpriority(PRIO_PROCESS, 0, context->nice) < 0) {
+ if (context->nice_set) {
+ r = setpriority(PRIO_PROCESS, 0, context->nice);
+ if (r == -EPERM || r == -EACCES) {
+ log_open();
+ log_unit_debug_errno(unit, r, "Failed to adjust Nice setting, assuming containerized execution, ignoring: %m");
+ log_close();
+ } else if (r < 0) {
*exit_status = EXIT_NICE;
+ *error_message = strdup("Failed to adjust Nice setting");
return -errno;
}
+ }
if (context->cpu_sched_set) {
struct sched_param param = {