1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 11:55:44 +03:00

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>
This commit is contained in:
Kay Sievers 2005-07-17 09:40:29 -04:00
parent 594dd61025
commit 422d5becc3
2 changed files with 6 additions and 3 deletions

View File

@ -497,6 +497,3 @@ int main(int argc, char **argv)
}
exit(retval);
}

View File

@ -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");