* 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,29 +161,43 @@ iterate_dev (const char *devname)
/* Complete the partition part. */
dev = grub_device_open (devname);
if (dev)
if (!dev)
{
char tmp[grub_strlen (devname) + sizeof (",")];
grub_memcpy (tmp, devname, grub_strlen (devname));
if (grub_strcmp (devname, current_word) == 0)
{
if (add_completion (devname, ")", GRUB_COMPLETION_TYPE_PARTITION))
return 1;
if (dev->disk)
if (grub_partition_iterate (dev->disk, iterate_partition))
return 1;
}
else
{
grub_memcpy (tmp + grub_strlen (devname), "", sizeof (""));
if (add_completion (tmp, "", GRUB_COMPLETION_TYPE_DEVICE))
return 1;
}
grub_errno = GRUB_ERR_NONE;
return 0;
}
{
char tmp[grub_strlen (devname) + sizeof (",")];
grub_memcpy (tmp, devname, grub_strlen (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;
}