bin/zoneconf: Fix preserving-config.
[zoneconf] / bin / zoneconf
index e988a83..8e0646d 100755 (executable)
@@ -60,13 +60,14 @@ proc merge-lists {lists} {
     set cand {}
     foreach list $lists { pushnew cand [lindex $list 0] }
 
-    ## Remove candidate items which have not the first in some other list.
+    ## Remove candidate items which are not first in some other list.
     set ncand {}
     foreach cand $cand {
       foreach list $lists {
-       if {[lsearch -exact $list $cand] < 0} { lappend ncand $cand }
+       if {[lsearch -exact $list $cand] <= 0} { lappend ncand $cand }
       }
     }
+    set cand $ncand
 
     ## If there's nothing left, report an error.
     if {![llength $cand]} {
@@ -311,7 +312,7 @@ proc preserving-config {confvar body} {
   ## Evaluate BODY, but on exit restore the CONFVAR array so that the BODY
   ## has no lasting effect on it.
 
-  upvar #1 $confvar CONFIG
+  upvar #0 $confvar CONFIG
   set old [array get CONFIG]
   unwind-protect {
     uplevel 1 $body