Michal Schmidt d962ba
From 8573eb093a4ccd6e966b60a68236f403dbd67d56 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
Michal Schmidt d962ba
Subject: [PATCH 06/12] 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
(cherry picked from commit 20f8d3cf1be4ad76234ffb85eeae7f9892ee72cd)
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
Michal Schmidt d962ba
index 9b8b7d3..696dd10 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
 
Michal Schmidt d962ba
-- 
Michal Schmidt d962ba
2.1.0
Michal Schmidt d962ba