X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=lib%2Flibzfs%2Flibzfs_import.c;h=ad343e896ea32842fbf8b65546a6cfd030c32105;hb=2ae10319624869eef0954cdfcdb6f5e33cba2e09;hp=c2d87f83049fa61b2cf2d07fb483144cbe2fd456;hpb=44867b6d6effc1628dd00c36821ab044f89fb988;p=zfs.git diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index c2d87f8..ad343e8 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; } } @@ -984,9 +984,7 @@ err_blkid1: } #endif /* HAVE_LIBBLKID */ -#define DEFAULT_IMPORT_PATH_SIZE 8 - -static char * +char * zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE] = { "/dev/disk/by-vdev", /* Custom rules, use first if they exist */ "/dev/disk/zpool", /* Custom rules, use first if they exist */ @@ -1144,14 +1142,15 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg) if (config != NULL) { boolean_t matched = B_TRUE; + char *pname; + + if ((iarg->poolname != NULL) && + (nvlist_lookup_string(config, + ZPOOL_CONFIG_POOL_NAME, &pname) == 0)) { - if (iarg->poolname != NULL) { - char *pname; + if (strcmp(iarg->poolname, pname)) + matched = B_FALSE; - matched = nvlist_lookup_string(config, - ZPOOL_CONFIG_POOL_NAME, - &pname) == 0 && - strcmp(iarg->poolname, pname) == 0; } else if (iarg->guid != 0) { uint64_t this_guid;