pragma GCC diagnostic is a gcc 4.6+ feature, compilation fails with
older compilers:
inspect-fs-windows.c: In function 'map_registry_disk_blob':
inspect-fs-windows.c:502: error: #pragma GCC diagnostic not allowed inside functions
inspect-fs-windows.c:503: error: #pragma GCC diagnostic not allowed inside functions
inspect-fs-windows.c:505: error: #pragma GCC diagnostic not allowed inside functions
make[3]: *** [libguestfs_la-inspect-fs-windows.lo] Error 1
Use memcpy instead of pragma to fix compile error.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
Not compile tested!
src/inspect-fs-windows.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index 346cc55..68ae97c 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -499,10 +499,8 @@ map_registry_disk_blob (guestfs_h *g, const void *blob)
* Note deliberate cast-align violation here since the data is in a
* very odd place within the blob. Thanks Microsoft!
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-align"
- part_offset = le64toh (* (uint64_t *) ((char *) blob + 4));
-#pragma GCC diagnostic pop
+ memcpy(&part_offset, (char *) blob + 4, sizeof(part_offset));
+ part_offset = le64toh (part_offset);
partitions = guestfs_part_list (g, devices[i]);
if (partitions == NULL)