summaryrefslogtreecommitdiff
path: root/src/busctl/busctl.c
diff options
context:
space:
mode:
authorAlin Popa <alin.popa@bmw.de>2020-02-14 09:33:43 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-02-16 02:09:26 +0900
commitbec31cf5f0037dd049299e8665e03fc74024e357 (patch)
treed97bd1ed6fb7b2e968823c65cd2ef91e474117c9 /src/busctl/busctl.c
parentc315b79fb43a4d921a533ba0c2cb303324887993 (diff)
downloadsystemd-bec31cf5f0037dd049299e8665e03fc74024e357.tar.gz
systemd: Fix busctl crash on aarch64 when setting output table format
The enum used for column names is integer type while table_set_display() is parsing arguments on size_t alignment which may result in assert in table_set_display() if the size between types missmatch. This patch cast the enums to size_t. An alternative solution would be to change the table_set_display() function arguments to unsigned type.
Diffstat (limited to 'src/busctl/busctl.c')
-rw-r--r--src/busctl/busctl.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index 5f3d5ddf39..b4e133ff95 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -212,9 +212,27 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
return log_error_errno(r, "Failed to set sort column: %m");
if (arg_show_machine)
- r = table_set_display(table, COLUMN_NAME, COLUMN_PID, COLUMN_PROCESS, COLUMN_USER, COLUMN_CONNECTION, COLUMN_UNIT, COLUMN_SESSION, COLUMN_DESCRIPTION, COLUMN_MACHINE, (size_t) -1);
+ r = table_set_display(table, (size_t) COLUMN_NAME,
+ (size_t) COLUMN_PID,
+ (size_t) COLUMN_PROCESS,
+ (size_t) COLUMN_USER,
+ (size_t) COLUMN_CONNECTION,
+ (size_t) COLUMN_UNIT,
+ (size_t) COLUMN_SESSION,
+ (size_t) COLUMN_DESCRIPTION,
+ (size_t) COLUMN_MACHINE,
+ (size_t) -1);
else
- r = table_set_display(table, COLUMN_NAME, COLUMN_PID, COLUMN_PROCESS, COLUMN_USER, COLUMN_CONNECTION, COLUMN_UNIT, COLUMN_SESSION, COLUMN_DESCRIPTION, (size_t) -1);
+ r = table_set_display(table, (size_t) COLUMN_NAME,
+ (size_t) COLUMN_PID,
+ (size_t) COLUMN_PROCESS,
+ (size_t) COLUMN_USER,
+ (size_t) COLUMN_CONNECTION,
+ (size_t) COLUMN_UNIT,
+ (size_t) COLUMN_SESSION,
+ (size_t) COLUMN_DESCRIPTION,
+ (size_t) -1);
+
if (r < 0)
return log_error_errno(r, "Failed to set columns to display: %m");