aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-07-03 09:16:46 -0700
committerBrian Behlendorf <[email protected]>2013-07-03 09:20:52 -0700
commitc76955eaa5477a71f711e6865a923e7055f8b3cb (patch)
tree5a270d939fbd7bb56b4dd852d8f6ba99ed0a98b5 /cmd
parent294f68063b49c06d3118d51016811063e69cf97a (diff)
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 <[email protected]> Closes #1560
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mount_zfs/mount_zfs.c10
1 files changed, 6 insertions, 4 deletions
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:
/*