]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-06-08 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Mon, 8 Jun 2009 13:25:54 +0000 (13:25 +0000)
committerproski <proski@localhost>
Mon, 8 Jun 2009 13:25:54 +0000 (13:25 +0000)
* fs/hfs.c (grub_hfs_find_dir): Use union to avoid a warning
about aliasing.

ChangeLog
fs/hfs.c

index 92dd90c90f5d9aa13e57bd5124d290b2ebe2d260..b9ef1ba4039d911126ff0f7464bc54837ed49099 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * Makefile.in (uninstall): Remove all $lib_DATA files.
index fe5d2694fcaa9b97b6a48172feb911c84e44a71f..e8821e092a1ab6254a4d6c7b9e3eda319011cb98 100644 (file)
--- a/fs/hfs.c
+++ b/fs/hfs.c
@@ -872,9 +872,12 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
   int inode = data->rootdir;
   char *next;
   char *origpath;
-  struct grub_hfs_filerec frec;
-  struct grub_hfs_dirrec *dir = (struct grub_hfs_dirrec *) &frec;
-  frec.type = GRUB_HFS_FILETYPE_DIR;
+  union {
+    struct grub_hfs_filerec frec;
+    struct grub_hfs_dirrec dir;
+  } fdrec;
+
+  fdrec.frec.type = GRUB_HFS_FILETYPE_DIR;
   
   if (path[0] != '/')
     {
@@ -892,7 +895,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *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");
          goto fail;
@@ -914,7 +917,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
       
       /* Lookup this node.  */
       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");
          goto fail;
@@ -923,12 +926,12 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
       if (grub_errno)
        goto fail;
       
-      inode = grub_be_to_cpu32 (dir->dirid);
+      inode = grub_be_to_cpu32 (fdrec.dir.dirid);
       path = next;
     }
 
   if (retdata)
-    grub_memcpy (retdata, &frec, sizeof (frec));
+    grub_memcpy (retdata, &fdrec.frec, sizeof (fdrec.frec));
   
   if (retinode)
     *retinode = inode;