naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
21255d
From 1730f7bb306e13689a7684fd93ae5b8383a28d2f Mon Sep 17 00:00:00 2001
21255d
From: Michal Sekletar <msekletar@users.noreply.github.com>
21255d
Date: Fri, 31 May 2019 15:23:23 +0200
21255d
Subject: [PATCH] dbus-execute: make transfer of CPUAffinity endian safe
21255d
 (#12711)
21255d
21255d
We store the affinity mask in the native endian. However, over D-Bus we
21255d
must transfer the mask in little endian byte order.
21255d
21255d
This is the second part of c367f996f5f091a63f812f0140b304c649be77fc.
21255d
21255d
(cherry picked from commit 75e40119a471454516ad0acc96f6f4094e7fb652)
21255d
21255d
Related: #1740657
21255d
---
21255d
 src/core/dbus-execute.c | 5 ++++-
21255d
 1 file changed, 4 insertions(+), 1 deletion(-)
21255d
21255d
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
21255d
index f9527e56b2..d5acca384f 100644
21255d
--- a/src/core/dbus-execute.c
21255d
+++ b/src/core/dbus-execute.c
21255d
@@ -215,12 +215,15 @@ static int property_get_cpu_affinity(
21255d
                 sd_bus_error *error) {
21255d
 
21255d
         ExecContext *c = userdata;
21255d
+        _cleanup_free_ uint8_t *array = NULL;
21255d
+        size_t allocated;
21255d
 
21255d
         assert(bus);
21255d
         assert(reply);
21255d
         assert(c);
21255d
 
21255d
-        return sd_bus_message_append_array(reply, 'y', c->cpu_set.set, c->cpu_set.allocated);
21255d
+        (void) cpu_set_to_dbus(&c->cpu_set, &array, &allocated);
21255d
+        return sd_bus_message_append_array(reply, 'y', array, allocated);
21255d
 }
21255d
 
21255d
 static int property_get_numa_mask(