summaryrefslogtreecommitdiff
path: root/sys/dev/microcode/atmel
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2005-05-17 18:48:53 +0000
committerJason Wright <jason@cvs.openbsd.org>2005-05-17 18:48:53 +0000
commitef9da74a3a85403b02a5cccc664dd784d8fd4279 (patch)
tree4efe4dece78a33358d376f9c897bb5809afe155e /sys/dev/microcode/atmel
parente9fcc6219571e8e6318ebd29c06ddb2f9833431a (diff)
- 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')
-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);
}