diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-08-25 21:43:25 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-08-25 21:43:25 +0000 |
commit | 4d966d66840ff6234f2b88ff76fc25f1b9f8554a (patch) | |
tree | 61470e5f567524c9b90e906894eb6d2387ea0721 /sys/dev | |
parent | e26aea87003b063bab85681d284dfcbd4d31d765 (diff) |
if we do not use __packed, we must write the values more carefully
ok mglocker
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/microcode/udl/build.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/microcode/udl/build.c b/sys/dev/microcode/udl/build.c index 4d7c076e42b..e9929f250fb 100644 --- a/sys/dev/microcode/udl/build.c +++ b/sys/dev/microcode/udl/build.c @@ -1,4 +1,4 @@ -/* $OpenBSD: build.c,v 1.1 2009/08/25 19:04:49 mglocker Exp $ */ +/* $OpenBSD: build.c,v 1.2 2009/08/25 21:43:24 deraadt Exp $ */ /* * Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org> @@ -30,14 +30,18 @@ int main(void) { int fd, i; + uint8_t size; + uint32_t value; fd = open(FILENAME, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd == -1) err(1, "%s", FILENAME); for (i = 0; i < UDL_HUFFMAN_RECORDS; i++) { - udl_huffman[i].value = htobe32(udl_huffman[i].value); - write(fd, &udl_huffman[i], 5); + size = udl_huffman[i].size; + value = htobe32(udl_huffman[i].value); + write(fd, &size, sizeof(size)); + write(fd, &value, sizeof(value)); } close(fd); |