summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hostname/hostnamectl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index a1e1bd8443..064581a31c 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -79,14 +79,18 @@ static void print_status_info(StatusInfo *i) {
printf(" Static hostname: %s\n",
strna(i->static_hostname));
- if (!streq_ptr(i->hostname, i->static_hostname))
+ if (!isempty(i->pretty_hostname) &&
+ !streq_ptr(i->pretty_hostname, i->static_hostname))
+ printf(" Pretty hostname: %s\n",
+ strna(i->pretty_hostname));
+
+ if (!isempty(i->hostname) &&
+ !streq_ptr(i->hostname, i->static_hostname))
printf("Transient hostname: %s\n",
strna(i->hostname));
- printf(" Pretty hostname: %s\n"
- " Icon name: %s\n"
+ printf(" Icon name: %s\n"
" Chassis: %s\n",
- strna(i->pretty_hostname),
strna(i->icon_name),
strna(i->chassis));