From 0a2f7b3662fd10e7ac56a4b2859248eb98e31d6d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 18 Sep 2012 12:33:00 -0700 Subject: [PATCH] Seg fault 'zpool import -d /dev/disk/by-id -a' Introduced by commit 44867b6d6effc1628dd00c36821ab044f89fb988. We should of course check to ensure best isn't NULL before attempting to dereference it. Signed-off-by: Brian Behlendorf Closes #974 --- lib/libzfs/libzfs_import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index c2d87f83..b5cac609 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -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; } } -- 2.39.5