2009-06-08 Pavel Roskin <proski@gnu.org>

* fs/hfs.c (grub_hfs_find_dir): Use union to avoid a warning
	about aliasing.
This commit is contained in:
proski 2009-06-08 13:25:54 +00:00
parent af3612634d
commit b57ea2c975
2 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2009-06-08 Pavel Roskin <proski@gnu.org>
* fs/hfs.c (grub_hfs_find_dir): Use union to avoid a warning
about aliasing.
2009-06-08 Felix Zielcke <fzielcke@z-51.de> 2009-06-08 Felix Zielcke <fzielcke@z-51.de>
* Makefile.in (uninstall): Remove all $lib_DATA files. * Makefile.in (uninstall): Remove all $lib_DATA files.

View file

@ -872,9 +872,12 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
int inode = data->rootdir; int inode = data->rootdir;
char *next; char *next;
char *origpath; char *origpath;
struct grub_hfs_filerec frec; union {
struct grub_hfs_dirrec *dir = (struct grub_hfs_dirrec *) &frec; struct grub_hfs_filerec frec;
frec.type = GRUB_HFS_FILETYPE_DIR; struct grub_hfs_dirrec dir;
} fdrec;
fdrec.frec.type = GRUB_HFS_FILETYPE_DIR;
if (path[0] != '/') if (path[0] != '/')
{ {
@ -892,7 +895,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
while (path && grub_strlen (path)) while (path && grub_strlen (path))
{ {
if (frec.type != GRUB_HFS_FILETYPE_DIR) if (fdrec.frec.type != GRUB_HFS_FILETYPE_DIR)
{ {
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
goto fail; goto fail;
@ -914,7 +917,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
/* Lookup this node. */ /* Lookup this node. */
if (! grub_hfs_find_node (data, (char *) &key, data->cat_root, if (! grub_hfs_find_node (data, (char *) &key, data->cat_root,
0, (char *) &frec, sizeof (frec))) 0, (char *) &fdrec.frec, sizeof (fdrec.frec)))
{ {
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
goto fail; goto fail;
@ -923,12 +926,12 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
if (grub_errno) if (grub_errno)
goto fail; goto fail;
inode = grub_be_to_cpu32 (dir->dirid); inode = grub_be_to_cpu32 (fdrec.dir.dirid);
path = next; path = next;
} }
if (retdata) if (retdata)
grub_memcpy (retdata, &frec, sizeof (frec)); grub_memcpy (retdata, &fdrec.frec, sizeof (fdrec.frec));
if (retinode) if (retinode)
*retinode = inode; *retinode = inode;