summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-07-17 09:40:29 -0400
committerKay Sievers <kay.sievers@suse.de>2005-07-17 09:40:29 -0400
commit422d5becc339304805bbe1e359f6389633036a98 (patch)
tree0aaa2667ac2a029aa3e7a404358917a312a170da /udev_rules_parse.c
parent594dd610252923591ed0f310695e82d3fb87e581 (diff)
add padding to rules structure
Some architectures really want well alingned structures. Thanks to Jim Gifford <maillist@jg555.com> for help finding it. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index 0259268c8f..e708f35558 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -241,6 +241,7 @@ static int add_to_rules(struct udev_rules *rules, char *line)
int valid;
char *linepos;
char *attr;
+ size_t padding;
int retval;
/* get all the keys */
@@ -506,6 +507,11 @@ static int add_to_rules(struct udev_rules *rules, char *line)
/* grow buffer and add rule */
rule_size = sizeof(struct udev_rule) + rule->bufsize;
+ padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t);
+ dbg("add %zi padding bytes", padding);
+ rule_size += padding;
+ rule->bufsize += padding;
+
rules->buf = realloc(rules->buf, rules->bufsize + rule_size);
if (!rules->buf) {
err("realloc failed");