ui/ncurses: clear DNS server setting before appending new servers
authorJeremy Kerr <jk@ozlabs.org>
Mon, 7 Apr 2014 00:58:57 +0000 (08:58 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 7 Apr 2014 03:49:08 +0000 (11:49 +0800)
Currently, we have a bug where newly-configured DNS servers are appended
to the existing set of servers, rather than replacing them.

This change clears the existing servers out before adding the
newly-configured ones.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-config.c

index 64d0619b66c66703dc64c9d08c9b50e07dfc3903..f4fa073308e88c3246f30bd5357b433173bac05c 100644 (file)
@@ -249,6 +249,10 @@ static int screen_process_form(struct config_screen *screen)
        }
 
        str = widget_textbox_get_value(screen->widgets.dns_f);
        }
 
        str = widget_textbox_get_value(screen->widgets.dns_f);
+       talloc_free(config->network.dns_servers);
+       config->network.dns_servers = NULL;
+       config->network.n_dns_servers = 0;
+
        if (str && strlen(str)) {
                char *dns, *tmp;
                int i;
        if (str && strlen(str)) {
                char *dns, *tmp;
                int i;