diff options
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r-- | src/core/dbus-execute.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index fd73c7bcb7..c5a51bf5cd 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -2718,15 +2718,15 @@ int bus_exec_context_set_transient_property( return 1; } else if (streq(name, "CPUSchedulingPriority")) { - int32_t p, min, max; + int32_t p; r = sd_bus_message_read(message, "i", &p); if (r < 0) return r; - min = sched_get_priority_min(c->cpu_sched_policy); - max = sched_get_priority_max(c->cpu_sched_policy); - if (p < min || p > max) + /* On Linux RR/FIFO range from 1 to 99 and OTHER/BATCH may only be 0. Policy might be set + * later so we do not check the precise range, but only the generic outer bounds. */ + if (p < 0 || p > 99) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid CPU scheduling priority: %i", p); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { |