Seg fault 'zpool import -d /dev/disk/by-id -a'

Introduced by commit 44867b6d6e.
We should of course check to ensure best isn't NULL before
attempting to dereference it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #974
This commit is contained in:
Brian Behlendorf 2012-09-18 12:33:00 -07:00
parent 211204bed3
commit 0a2f7b3662

View File

@ -173,7 +173,7 @@ fix_paths(nvlist_t *nv, name_entry_t *names)
break;
}
if (ne->ne_order < best->ne_order || best == NULL)
if (best == NULL || ne->ne_order < best->ne_order)
best = ne;
}
}