summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-01-29 13:02:32 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-01-29 13:02:32 +0000
commit8a9ab5d2b77b4dee07dc897da5cce4803629b642 (patch)
treea454279f71ffbcd4f4af43078a6d67f999437b6b /sys/arch
parent94df645ebfff43be5a8699deed4a7e92af072efb (diff)
More read/write result checking fixes to avoid unsigned comparisons vs
-1. ok henning@ beck@ ray@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/stand/headersize.c4
-rw-r--r--sys/arch/aviion/stand/a2coff/a2coff.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/arch/alpha/stand/headersize.c b/sys/arch/alpha/stand/headersize.c
index b1e9d7e318f..f68dfa3daad 100644
--- a/sys/arch/alpha/stand/headersize.c
+++ b/sys/arch/alpha/stand/headersize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: headersize.c,v 1.8 2005/08/10 16:58:42 todd Exp $ */
+/* $OpenBSD: headersize.c,v 1.9 2008/01/29 13:02:31 krw Exp $ */
/* $NetBSD: headersize.c,v 1.5 1996/09/23 04:32:59 cgd Exp $ */
/*
@@ -63,7 +63,7 @@ main(argc, argv)
if ((fd = open(fname, O_RDONLY, 0)) == -1)
err(1, "%s: open failed", fname);
- if (read(fd, &buf, HDR_BUFSIZE) < HDR_BUFSIZE)
+ if (read(fd, &buf, HDR_BUFSIZE) != HDR_BUFSIZE)
err(1, "%s: read failed", fname);
#ifdef ALPHA_BOOT_ELF
elfp = (Elf64_Ehdr *)buf;
diff --git a/sys/arch/aviion/stand/a2coff/a2coff.c b/sys/arch/aviion/stand/a2coff/a2coff.c
index 36a7f123434..7abad536334 100644
--- a/sys/arch/aviion/stand/a2coff/a2coff.c
+++ b/sys/arch/aviion/stand/a2coff/a2coff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: a2coff.c,v 1.2 2006/05/14 17:49:54 miod Exp $ */
+/* $OpenBSD: a2coff.c,v 1.3 2008/01/29 13:02:31 krw Exp $ */
/*
* Copyright (c) 2006, Miodrag Vallat
*
@@ -179,7 +179,7 @@ main(int argc, char *argv[])
ehead.a.data_start = N_DATADDR(head); /* ignored */
n = write(outfd, &ehead, sizeof(ehead));
- if (n < sizeof(ehead))
+ if (n != sizeof(ehead))
err(1, "write");
/*
@@ -224,7 +224,7 @@ main(int argc, char *argv[])
escn[2].s_vaddr = escn[2].s_paddr;
n = write(outfd, &escn, sizeof(escn));
- if (n < sizeof(escn))
+ if (n != sizeof(escn))
err(1, "write");
/*
@@ -276,9 +276,9 @@ copybits(int from, int to, u_int32_t count)
while (count != 0) {
chunk = min(count, sizeof buf);
- if (read(from, buf, chunk) < chunk)
+ if (read(from, buf, chunk) != chunk)
err(1, "read");
- if (write(to, buf, chunk) < chunk)
+ if (write(to, buf, chunk) != chunk)
err(1, "write");
count -= chunk;
}
@@ -292,7 +292,7 @@ zerobits(int to, u_int32_t count)
bzero(buf, sizeof buf);
while (count != 0) {
chunk = min(count, sizeof buf);
- if (write(to, buf, chunk) < chunk)
+ if (write(to, buf, chunk) != chunk)
err(1, "write");
count -= chunk;
}