summaryrefslogtreecommitdiffstats
path: root/sys/dev/microcode/atmel/build.c
diff options
context:
space:
mode:
authorjason <jason@openbsd.org>2005-05-17 18:48:51 +0000
committerjason <jason@openbsd.org>2005-05-17 18:48:51 +0000
commit948e15b6b2bf9046e4ca3393b8e23a3f20147477 (patch)
tree02d041e5bc1957186636006fd686dc4a8e2d38db /sys/dev/microcode/atmel/build.c
parentNeed to find a way to detect if fw supports disabling hold of timers before (diff)
downloadwireguard-openbsd-948e15b6b2bf9046e4ca3393b8e23a3f20147477.tar.xz
wireguard-openbsd-948e15b6b2bf9046e4ca3393b8e23a3f20147477.zip
- check return from write(2) so we KNOW the data is on the disk
- remove unneeded variables - add missing includes ok deraadt
Diffstat (limited to 'sys/dev/microcode/atmel/build.c')
-rw-r--r--sys/dev/microcode/atmel/build.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/microcode/atmel/build.c b/sys/dev/microcode/atmel/build.c
index 0a4bf972968..b83741284e4 100644
--- a/sys/dev/microcode/atmel/build.c
+++ b/sys/dev/microcode/atmel/build.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: build.c,v 1.8 2005/03/08 11:50:39 dlg Exp $ */
+/* $OpenBSD: build.c,v 1.9 2005/05/17 18:48:51 jason Exp $ */
/*
* Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
@@ -17,6 +17,9 @@
*/
#include <sys/types.h>
#include <fcntl.h>
+#include <stdio.h>
+#include <err.h>
+#include <unistd.h>
#include "atmel_intersil_fw.h"
#include "atmel_rfmd2958-smc_fw.h"
@@ -30,7 +33,7 @@
void
output(const char *name, char *buf, int buflen)
{
- int i;
+ ssize_t rlen;
int fd;
printf("creating %s length %d\n", name, buflen);
@@ -38,7 +41,11 @@ output(const char *name, char *buf, int buflen)
if (fd == -1)
err(1, "%s", name);
- write(fd, buf, buflen);
+ rlen = write(fd, buf, buflen);
+ if (rlen == -1)
+ err(1, "%s", name);
+ if (rlen != buflen)
+ errx(1, "%s: short write", name);
close(fd);
}