anitazha / rpms / systemd

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