* grub-core/normal/completion.c (iterate_dev): Close the disk.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-01-29 18:20:02 +01:00
parent 9c6e84b838
commit f990cbf90e
2 changed files with 38 additions and 20 deletions

View file

@ -1,3 +1,7 @@
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/completion.c (iterate_dev): Close the disk.
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
Cryptodisk write support.

View file

@ -161,7 +161,11 @@ iterate_dev (const char *devname)
/* Complete the partition part. */
dev = grub_device_open (devname);
if (dev)
if (!dev)
{
grub_errno = GRUB_ERR_NONE;
return 0;
}
{
char tmp[grub_strlen (devname) + sizeof (",")];
@ -170,20 +174,30 @@ iterate_dev (const char *devname)
if (grub_strcmp (devname, current_word) == 0)
{
if (add_completion (devname, ")", GRUB_COMPLETION_TYPE_PARTITION))
{
grub_device_close (dev);
return 1;
}
if (dev->disk)
if (grub_partition_iterate (dev->disk, iterate_partition))
{
grub_device_close (dev);
return 1;
}
}
else
{
grub_memcpy (tmp + grub_strlen (devname), "", sizeof (""));
if (add_completion (tmp, "", GRUB_COMPLETION_TYPE_DEVICE))
{
grub_device_close (dev);
return 1;
}
}
}
grub_device_close (dev);
grub_errno = GRUB_ERR_NONE;
return 0;
}