[Libguestfs] [PATCH] lib: avoid pragma usage in journal.c

Olaf Hering olaf at aepfle.de
Tue Aug 20 14:33:01 UTC 2013


journal.c: In function 'guestfs__journal_get':
journal.c:120:9: error: #pragma GCC diagnostic not allowed inside functions
journal.c:121:9: error: #pragma GCC diagnostic not allowed inside functions
journal.c:123:9: error: #pragma GCC diagnostic not allowed inside functions
make[3]: *** [libguestfs_la-journal.lo] Error 1

Signed-off-by: Olaf Hering <olaf at aepfle.de>
---

Not compiled.

 src/journal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/journal.c b/src/journal.c
index cac8040..61ab352 100644
--- a/src/journal.c
+++ b/src/journal.c
@@ -117,10 +117,8 @@ guestfs__journal_get (guestfs_h *g)
              "size=%zu, i=%zu", size, i);
       goto err;
     }
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-align"
-    len = be64toh (* (uint64_t *) &buf[i]);
-#pragma GCC diagnostic pop
+    memcpy(&len, &buf[i], sizeof(len));
+    len = be64toh (len);
     i += 8;
     eofield = &buf[i+len];
     if (eofield > eobuf) {




More information about the Libguestfs mailing list