chiark / gitweb /
timesyncd-manager: don't clear current_server_name if ServerAddress is NULL
authorSteven Noonan <steven@uplinklabs.net>
Sat, 30 Aug 2014 12:58:06 +0000 (05:58 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 31 Aug 2014 01:18:57 +0000 (21:18 -0400)
https://bugs.freedesktop.org/show_bug.cgi?id=83091

[zj: add comment]

src/timesync/timesyncd-manager.c

index 9b8b7d3eb6886790aba0cb2151806c4aa3c63b7c..696dd10e69fd0cb0cccae7f8f4213e96bf7f7784 100644 (file)
@@ -766,8 +766,11 @@ void manager_set_server_address(Manager *m, ServerAddress *a) {
         if (m->current_server_address == a)
                 return;
 
         if (m->current_server_address == a)
                 return;
 
-        m->current_server_name = a ? a->name : NULL;
         m->current_server_address = a;
         m->current_server_address = a;
+        /* If a is NULL, we are just clearing the address, without
+         * changing the name. Keep the existing name in that case. */
+        if (a)
+                m->current_server_name = a->name;
 
         manager_disconnect(m);
 
 
         manager_disconnect(m);