heal: Fix new entries computation in listDirHeal (#3551)

A crash was happening due to an incorrect interpreation of the return value of sort.SearchString()
This commit is contained in:
Anis Elleuch 2017-01-10 00:48:13 +01:00 committed by Harshavardhana
parent 95d9e47353
commit eb6d53d2f5

View File

@ -58,7 +58,9 @@ func listDirHealFactory(isLeaf isLeafFunc, disks ...StorageAPI) listDirFunc {
// find elements in entries which are not in mergedentries
for _, entry := range entries {
idx := sort.SearchStrings(mergedEntries, entry)
if mergedEntries[idx] == entry {
// idx different from len(mergedEntries) means entry is not found
// in mergedEntries
if idx < len(mergedEntries) {
continue
}
newEntries = append(newEntries, entry)