Zbigniew Jędrzejewski-Szmek 62fe94
From 20f8d3cf1be4ad76234ffb85eeae7f9892ee72cd Mon Sep 17 00:00:00 2001
Michal Schmidt d962ba
From: Steven Noonan <steven@uplinklabs.net>
Michal Schmidt d962ba
Date: Sat, 30 Aug 2014 05:58:06 -0700
Zbigniew Jędrzejewski-Szmek 62fe94
Subject: [PATCH] timesyncd-manager: don't clear current_server_name if
Michal Schmidt d962ba
 ServerAddress is NULL
Michal Schmidt d962ba
Michal Schmidt d962ba
https://bugs.freedesktop.org/show_bug.cgi?id=83091
Michal Schmidt d962ba
Michal Schmidt d962ba
[zj: add comment]
Michal Schmidt d962ba
---
Michal Schmidt d962ba
 src/timesync/timesyncd-manager.c | 5 ++++-
Michal Schmidt d962ba
 1 file changed, 4 insertions(+), 1 deletion(-)
Michal Schmidt d962ba
Michal Schmidt d962ba
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
Zbigniew Jędrzejewski-Szmek 62fe94
index 9b8b7d3eb6..696dd10e69 100644
Michal Schmidt d962ba
--- a/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
+++ b/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
@@ -766,8 +766,11 @@ void manager_set_server_address(Manager *m, ServerAddress *a) {
Michal Schmidt d962ba
         if (m->current_server_address == a)
Michal Schmidt d962ba
                 return;
Michal Schmidt d962ba
 
Michal Schmidt d962ba
-        m->current_server_name = a ? a->name : NULL;
Michal Schmidt d962ba
         m->current_server_address = a;
Michal Schmidt d962ba
+        /* If a is NULL, we are just clearing the address, without
Michal Schmidt d962ba
+         * changing the name. Keep the existing name in that case. */
Michal Schmidt d962ba
+        if (a)
Michal Schmidt d962ba
+                m->current_server_name = a->name;
Michal Schmidt d962ba
 
Michal Schmidt d962ba
         manager_disconnect(m);
Michal Schmidt d962ba