From: Mark Wooding Date: Sat, 3 Dec 2011 19:22:00 +0000 (+0000) Subject: bin/zoneconf: Fix merge-lists. X-Git-Tag: 1.0.0~6 X-Git-Url: https://git.distorted.org.uk/~mdw/zoneconf/commitdiff_plain/2042733dc4f99c1ef70102ac87a24486a78ca94a bin/zoneconf: Fix merge-lists. * Don't remove a candidate which is first in multiple lists. * Actually use the pruned list. --- diff --git a/bin/zoneconf b/bin/zoneconf index e988a83..c8ac895 100755 --- a/bin/zoneconf +++ b/bin/zoneconf @@ -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]} {