* grub-core/normal/completion.c (iterate_dev): Close the disk.
This commit is contained in:
parent
9c6e84b838
commit
f990cbf90e
2 changed files with 38 additions and 20 deletions
|
@ -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>
|
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Cryptodisk write support.
|
Cryptodisk write support.
|
||||||
|
|
|
@ -161,7 +161,11 @@ iterate_dev (const char *devname)
|
||||||
/* Complete the partition part. */
|
/* Complete the partition part. */
|
||||||
dev = grub_device_open (devname);
|
dev = grub_device_open (devname);
|
||||||
|
|
||||||
if (dev)
|
if (!dev)
|
||||||
|
{
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
char tmp[grub_strlen (devname) + sizeof (",")];
|
char tmp[grub_strlen (devname) + sizeof (",")];
|
||||||
|
|
||||||
|
@ -170,20 +174,30 @@ iterate_dev (const char *devname)
|
||||||
if (grub_strcmp (devname, current_word) == 0)
|
if (grub_strcmp (devname, current_word) == 0)
|
||||||
{
|
{
|
||||||
if (add_completion (devname, ")", GRUB_COMPLETION_TYPE_PARTITION))
|
if (add_completion (devname, ")", GRUB_COMPLETION_TYPE_PARTITION))
|
||||||
|
{
|
||||||
|
grub_device_close (dev);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (dev->disk)
|
if (dev->disk)
|
||||||
if (grub_partition_iterate (dev->disk, iterate_partition))
|
if (grub_partition_iterate (dev->disk, iterate_partition))
|
||||||
|
{
|
||||||
|
grub_device_close (dev);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_memcpy (tmp + grub_strlen (devname), "", sizeof (""));
|
grub_memcpy (tmp + grub_strlen (devname), "", sizeof (""));
|
||||||
if (add_completion (tmp, "", GRUB_COMPLETION_TYPE_DEVICE))
|
if (add_completion (tmp, "", GRUB_COMPLETION_TYPE_DEVICE))
|
||||||
|
{
|
||||||
|
grub_device_close (dev);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_device_close (dev);
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue