From: David Tardon Date: Mon, 20 Feb 2023 19:00:29 +0000 (+0100) Subject: systemctl: prepend machine ID to unit ID in list-sockets X-Git-Tag: v254-rc1~1202^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f748b2d01a03b04f01415ed7878fe4f9c605b8ff;p=thirdparty%2Fsystemd.git systemctl: prepend machine ID to unit ID in list-sockets We do it that way in all other list-* functions, so let's be consistent. --- diff --git a/src/systemctl/systemctl-list-units.c b/src/systemctl/systemctl-list-units.c index 93ea21acad2..ad0545cd689 100644 --- a/src/systemctl/systemctl-list-units.c +++ b/src/systemctl/systemctl-list-units.c @@ -398,21 +398,16 @@ static int output_sockets_list(struct socket_info *socket_infos, size_t cs) { table_set_ersatz_string(table, TABLE_ERSATZ_DASH); for (struct socket_info *s = socket_infos; s < socket_infos + cs; s++) { - _cleanup_free_ char *j = NULL; - const char *path; + _cleanup_free_ char *unit = NULL; - if (s->machine) { - j = strjoin(s->machine, ":", s->path); - if (!j) - return log_oom(); - path = j; - } else - path = s->path; + unit = format_unit_id(s->id, s->machine); + if (!unit) + return log_oom(); r = table_add_many(table, - TABLE_STRING, path, + TABLE_STRING, s->path, TABLE_STRING, s->type, - TABLE_STRING, s->id); + TABLE_STRING, unit); if (r < 0) return table_log_add_error(r);