]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: fix compiler warning [-Wstrict-aliasing]
authorKarel Zak <kzak@redhat.com>
Mon, 15 Oct 2012 15:01:30 +0000 (17:01 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 15 Oct 2012 15:01:30 +0000 (17:01 +0200)
libblkid/src/superblocks/befs.c: In function 'get_uuid':
libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/befs.c

index a7f4317ba5bace2fdf94307f0a6e104da3134252..452da1ecdd3c0e1761821a53395adcbddf3e9bdc 100644 (file)
@@ -348,9 +348,11 @@ static int get_uuid(blkid_probe pr, const struct befs_super_block *bs,
                        && FS16_TO_CPU(sd->name_size, fs_le) == strlen(KEY_NAME)
                        && FS16_TO_CPU(sd->data_size, fs_le) == KEY_SIZE
                        && strcmp(sd->name, KEY_NAME) == 0) {
-                       *uuid = *(uint64_t *) ((uint8_t *) sd->name
-                                       + FS16_TO_CPU(sd->name_size, fs_le)
-                                       + 3);
+
+                       memcpy(uuid,
+                              sd->name + FS16_TO_CPU(sd->name_size, fs_le) + 3,
+                              sizeof(uint64_t));
+
                        break;
                } else if (FS32_TO_CPU(sd->type, fs_le) == 0
                                && FS16_TO_CPU(sd->name_size, fs_le) == 0