From c76955eaa5477a71f711e6865a923e7055f8b3cb Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 3 Jul 2013 09:16:46 -0700 Subject: Fix parse_dataset error handling A mount failure was accidentally introduced by commit 0c1171d which reworked the parse_dataset() function to read pool names from devices. The error case where a label is read from the device but the pool name/value pair doesn't exist was not handled properly. In this case we should fall back to the previous behavior. Signed-off-by: Brian Behlendorf Closes #1560 --- cmd/mount_zfs/mount_zfs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cmd/mount_zfs') diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c index 27a9014b3..4db33ed69 100644 --- a/cmd/mount_zfs/mount_zfs.c +++ b/cmd/mount_zfs/mount_zfs.c @@ -246,11 +246,13 @@ parse_dataset(char *dataset) error = nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name); - if (error == 0) + if (error) { + nvlist_free(config); + } else { dataset = strdup(name); - - nvlist_free(config); - return (dataset); + nvlist_free(config); + return (dataset); + } } out: /* -- cgit v1.2.3