hostnamectl: fix hyperlink in "Operating System" field

This fixes a bug introduced by 822be62fb2.

Before this, if terminal width is not enough, the all subsequent lines
are included in the hyperlink.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1955475.
This commit is contained in:
Yu Watanabe 2021-05-04 18:00:12 +09:00 committed by Lennart Poettering
parent 296c13dec4
commit 8fc1efa88f

View file

@ -158,17 +158,10 @@ static int print_status_info(StatusInfo *i) {
}
if (!isempty(i->os_pretty_name)) {
_cleanup_free_ char *formatted = NULL;
const char *t = i->os_pretty_name;
if (i->home_url) {
if (terminal_urlify(i->home_url, i->os_pretty_name, &formatted) >= 0)
t = formatted;
}
r = table_add_many(table,
TABLE_STRING, "Operating System:",
TABLE_STRING, t);
TABLE_STRING, i->os_pretty_name,
TABLE_SET_URL, i->home_url);
if (r < 0)
return table_log_add_error(r);
}