2010-08-15 Robert Millan <rmh@gnu.org>

* kern/emu/misc.c (grub_get_libzfs_handle): Handle libzfs_init()
	errors.
	* kern/emu/getroot.c (find_root_device_from_libzfs): Handle
	grub_get_libzfs_handle() errors.
This commit is contained in:
Robert Millan 2010-08-15 22:48:23 +02:00
parent f3710e088c
commit 729a0f2e0c
3 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2010-08-15 Robert Millan <rmh@gnu.org>
* kern/emu/misc.c (grub_get_libzfs_handle): Handle libzfs_init()
errors.
* kern/emu/getroot.c (find_root_device_from_libzfs): Handle
grub_get_libzfs_handle() errors.
2010-08-14 Robert Millan <rmh@gnu.org>
* kern/emu/misc.c (grub_find_zpool_from_dir): Abort function if

View file

@ -188,11 +188,16 @@ find_root_device_from_libzfs (const char *dir)
{
zpool_handle_t *zpool;
libzfs_handle_t *libzfs;
nvlist_t *nvlist;
nvlist_t **nvlist_array;
unsigned int nvlist_count;
zpool = zpool_open (grub_get_libzfs_handle (), poolname);
libzfs = grub_get_libzfs_handle ();
if (! libzfs)
return NULL;
zpool = zpool_open (libzfs, poolname);
nvlist = zpool_get_config (zpool, NULL);
if (nvlist_lookup_nvlist (nvlist, "vdev_tree", &nvlist) != 0)

View file

@ -268,7 +268,9 @@ grub_get_libzfs_handle (void)
if (! __libzfs_handle)
{
__libzfs_handle = libzfs_init ();
atexit (fini_libzfs);
if (__libzfs_handle)
atexit (fini_libzfs);
}
return __libzfs_handle;