2010-08-01 Robert Millan <rmh@gnu.org>
Prevent accidental use of uninitialized libzfs_handle. * util/grub-probe.c (main): Move grub_util_init_libzfs() call to ... * kern/emu/getroot.c (find_root_device_from_libzfs): ... here. * util/misc.c (grub_util_init_libzfs): Make this function idempotent.
This commit is contained in:
parent
ce04ef47e2
commit
deb0caa38e
4 changed files with 15 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2010-08-01 Robert Millan <rmh@gnu.org>
|
||||||
|
|
||||||
|
Prevent accidental use of uninitialized libzfs_handle.
|
||||||
|
|
||||||
|
* util/grub-probe.c (main): Move grub_util_init_libzfs() call to ...
|
||||||
|
* kern/emu/getroot.c (find_root_device_from_libzfs): ... here.
|
||||||
|
* util/misc.c (grub_util_init_libzfs): Make this function idempotent.
|
||||||
|
|
||||||
2010-08-01 Colin Watson <cjwatson@ubuntu.com>
|
2010-08-01 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
* util/grub.d/20_linux_xen.in: Don't use UUID for LVM root (matching
|
* util/grub.d/20_linux_xen.in: Don't use UUID for LVM root (matching
|
||||||
|
|
|
@ -289,6 +289,8 @@ find_root_device_from_libzfs (const char *dir)
|
||||||
nvlist_t **nvlist_array;
|
nvlist_t **nvlist_array;
|
||||||
unsigned int nvlist_count;
|
unsigned int nvlist_count;
|
||||||
|
|
||||||
|
grub_util_init_libzfs ();
|
||||||
|
|
||||||
zpool = zpool_open (libzfs_handle, poolname);
|
zpool = zpool_open (libzfs_handle, poolname);
|
||||||
nvlist = zpool_get_config (zpool, NULL);
|
nvlist = zpool_get_config (zpool, NULL);
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,6 @@ main (int argc, char *argv[])
|
||||||
set_program_name (argv[0]);
|
set_program_name (argv[0]);
|
||||||
|
|
||||||
grub_util_init_nls ();
|
grub_util_init_nls ();
|
||||||
grub_util_init_libzfs ();
|
|
||||||
|
|
||||||
/* Check for options. */
|
/* Check for options. */
|
||||||
while (1)
|
while (1)
|
||||||
|
|
|
@ -309,8 +309,11 @@ void
|
||||||
grub_util_init_libzfs (void)
|
grub_util_init_libzfs (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBZFS
|
#ifdef HAVE_LIBZFS
|
||||||
|
if (! libzfs_handle)
|
||||||
|
{
|
||||||
libzfs_handle = libzfs_init ();
|
libzfs_handle = libzfs_init ();
|
||||||
atexit (fini_libzfs);
|
atexit (fini_libzfs);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue