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 <behlendorf1@llnl.gov>
Closes #1560
This commit is contained in:
Brian Behlendorf 2013-07-03 09:16:46 -07:00
parent 294f68063b
commit c76955eaa5
1 changed files with 6 additions and 4 deletions

View File

@ -246,12 +246,14 @@ 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);
}
}
out:
/*
* If a file or directory in your current working directory is