|
|
923a60 |
From fc0a9c4e9701370822014298849116da2d3e41f3 Mon Sep 17 00:00:00 2001
|
|
|
923a60 |
From: Jan Synacek <jsynacek@redhat.com>
|
|
|
923a60 |
Date: Tue, 30 Jan 2018 12:58:42 +0100
|
|
|
923a60 |
Subject: [PATCH] bus-util.c: fix TasksMax= property assignment
|
|
|
923a60 |
|
|
|
923a60 |
Also, with the current code structure, it's not possible to also set
|
|
|
923a60 |
the TasksMaxScale= in the same if branch, simply because how the
|
|
|
923a60 |
sd_bus_message_append() is used. In src/systemctl/systemctl.c, the
|
|
|
923a60 |
message container is already open in set_property().
|
|
|
923a60 |
|
|
|
923a60 |
Resolves: #1537147
|
|
|
923a60 |
---
|
|
|
923a60 |
src/libsystemd/sd-bus/bus-util.c | 15 ++++-----------
|
|
|
923a60 |
1 file changed, 4 insertions(+), 11 deletions(-)
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
|
|
|
923a60 |
index cbf1eccf77..b1bdbad2dd 100644
|
|
|
923a60 |
--- a/src/libsystemd/sd-bus/bus-util.c
|
|
|
923a60 |
+++ b/src/libsystemd/sd-bus/bus-util.c
|
|
|
923a60 |
@@ -1418,20 +1418,13 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
|
|
|
923a60 |
if (isempty(eq) || streq(eq, "infinity"))
|
|
|
923a60 |
t = (uint64_t) -1;
|
|
|
923a60 |
else {
|
|
|
923a60 |
- r = parse_percent(eq);
|
|
|
923a60 |
- if (r >= 0) {
|
|
|
923a60 |
- r = sd_bus_message_append(m, "sv", "TasksMaxScale", "u", (uint32_t) (((uint64_t) UINT32_MAX * r) / 100U));
|
|
|
923a60 |
- if (r < 0)
|
|
|
923a60 |
- return bus_log_create_error(r);
|
|
|
923a60 |
- } else {
|
|
|
923a60 |
- r = safe_atou64(eq, &t);
|
|
|
923a60 |
- if (r < 0)
|
|
|
923a60 |
- return log_error_errno(r, "Failed to parse maximum tasks specification %s", assignment);
|
|
|
923a60 |
- }
|
|
|
923a60 |
+ r = safe_atou64(eq, &t);
|
|
|
923a60 |
+ if (r < 0)
|
|
|
923a60 |
+ return log_error_errno(r, "Failed to parse maximum tasks specification %s", assignment);
|
|
|
923a60 |
|
|
|
923a60 |
}
|
|
|
923a60 |
|
|
|
923a60 |
- r = sd_bus_message_append(m, "sv", "TasksMax", "t", t);
|
|
|
923a60 |
+ r = sd_bus_message_append(m, "v", "t", t);
|
|
|
923a60 |
|
|
|
923a60 |
} else if (STR_IN_SET(field, "CPUShares", "StartupCPUShares")) {
|
|
|
923a60 |
uint64_t u;
|