anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0606-bus-util.c-fix-TasksMax-property-assignment.patch

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