]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
conf_copy_into must empty the entire target conf before filling it
authorSimon Tatham <anakin@pobox.com>
Fri, 15 Jul 2011 18:18:28 +0000 (18:18 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 15 Jul 2011 18:18:28 +0000 (18:18 +0000)
with the entries from the source one, otherwise add234 will keep
failing ("this key already exists"). Completely broke Plink, ahem.

[originally from svn r9218]

conf.c

diff --git a/conf.c b/conf.c
index 89bf5c3b3daf5a865baf762fdb3f0eb9365a3e34..326844995c4ad6a72b53dbb3ec731f8b7ac308e0 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -199,6 +199,8 @@ void conf_copy_into(Conf *newconf, Conf *oldconf)
     struct conf_entry *entry, *entry2;
     int i;
 
+    conf_clear(newconf);
+
     for (i = 0; (entry = index234(oldconf->tree, i)) != NULL; i++) {
        entry2 = snew(struct conf_entry);
        copy_key(&entry2->key, &entry->key);