* grub-core/fs/xfs.c (grub_xfs_iterate_dir): Handle read_inode errors.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-03 09:15:29 +02:00
parent f45c794ab5
commit 3b4afb4de1
2 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2012-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/xfs.c (grub_xfs_iterate_dir): Handle read_inode errors.
2012-05-03 Vladimir Serbinenko <phcoder@gmail.com> 2012-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/xfs.c (GRUB_XFS_EXTENT_BLOCK): Fix bitmask. * grub-core/fs/xfs.c (GRUB_XFS_EXTENT_BLOCK): Fix bitmask.

View file

@ -456,19 +456,28 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
int NESTED_FUNC_ATTR call_hook (grub_uint64_t ino, const char *filename) int NESTED_FUNC_ATTR call_hook (grub_uint64_t ino, const char *filename)
{ {
struct grub_fshelp_node *fdiro; struct grub_fshelp_node *fdiro;
grub_err_t err;
fdiro = grub_malloc (sizeof (struct grub_fshelp_node) fdiro = grub_malloc (sizeof (struct grub_fshelp_node)
- sizeof (struct grub_xfs_inode) - sizeof (struct grub_xfs_inode)
+ (1 << diro->data->sblock.log2_inode)); + (1 << diro->data->sblock.log2_inode));
if (!fdiro) if (!fdiro)
return 0; {
grub_print_error ();
return 0;
}
/* The inode should be read, otherwise the filetype can /* The inode should be read, otherwise the filetype can
not be determined. */ not be determined. */
fdiro->ino = ino; fdiro->ino = ino;
fdiro->inode_read = 1; fdiro->inode_read = 1;
fdiro->data = diro->data; fdiro->data = diro->data;
grub_xfs_read_inode (diro->data, ino, &fdiro->inode); err = grub_xfs_read_inode (diro->data, ino, &fdiro->inode);
if (err)
{
grub_print_error ();
return 0;
}
return hook (filename, return hook (filename,
grub_xfs_mode_to_filetype (fdiro->inode.mode), grub_xfs_mode_to_filetype (fdiro->inode.mode),