]> granicus.if.org Git - strace/commitdiff
quota: add packed attribute to struct if_dqblk definition
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 21 Sep 2016 03:12:01 +0000 (06:12 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 27 Sep 2016 00:57:27 +0000 (00:57 +0000)
Since the only difference between 32-bit and 64-bit environments
regarding this structure is its padding, lets just add packed attribute
to its definition instead of going full mpers.

* quota.c (struct if_dqblk): Add ATTRIBUTE_PACKED.

quota.c

diff --git a/quota.c b/quota.c
index 62792cd1cd0e539aba4536305157b61d9b91be24..7fec1ccd6436bddc2280c2f4598e84ff3a67874c 100644 (file)
--- a/quota.c
+++ b/quota.c
 #include "xlat/if_dqinfo_flags.h"
 #include "xlat/if_dqinfo_valid.h"
 
+/*
+ * We add attribute packed due to the fact that the structure is 8-byte aligned
+ * on 64-bit systems and therefore has additional 4 bytes of padding, which
+ * leads to problems when it is used on 32-bit tracee which does not have such
+ * padding.
+ */
 struct if_dqblk
 {
        uint64_t dqb_bhardlimit;
@@ -60,7 +66,7 @@ struct if_dqblk
        uint64_t dqb_btime;
        uint64_t dqb_itime;
        uint32_t dqb_valid;
-};
+} ATTRIBUTE_PACKED;
 
 struct if_nextdqblk {
        uint64_t dqb_bhardlimit;