diff options
author | 2009-08-25 21:43:24 +0000 | |
---|---|---|
committer | 2009-08-25 21:43:24 +0000 | |
commit | 117fa635faf738d759e7774ed95414a0e18ae3a0 (patch) | |
tree | d349bbd8eec37be7f3eb6eb957ab38b49805e319 /sys/dev/microcode | |
parent | sub-devices exposed by aucat and sockets it's listening on are (diff) | |
download | wireguard-openbsd-117fa635faf738d759e7774ed95414a0e18ae3a0.tar.xz wireguard-openbsd-117fa635faf738d759e7774ed95414a0e18ae3a0.zip |
if we do not use __packed, we must write the values more carefully
ok mglocker
Diffstat (limited to 'sys/dev/microcode')
-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); |