summaryrefslogtreecommitdiff
path: root/usr.sbin/mksuncd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
commit86ffccf24f66032a89d70a32b3609584c0db7345 (patch)
tree2ae97fac6ea5be57cc953baf8612e8f683da0172 /usr.sbin/mksuncd
parentce9fea47562d4f179d45680d6aec00ede2877141 (diff)
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
Diffstat (limited to 'usr.sbin/mksuncd')
-rw-r--r--usr.sbin/mksuncd/mksuncd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/mksuncd/mksuncd.c b/usr.sbin/mksuncd/mksuncd.c
index dc6becb3422..cd1114c0ed9 100644
--- a/usr.sbin/mksuncd/mksuncd.c
+++ b/usr.sbin/mksuncd/mksuncd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mksuncd.c,v 1.3 2015/10/12 07:45:48 deraadt Exp $ */
+/* $OpenBSD: mksuncd.c,v 1.4 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -282,7 +282,7 @@ adjust_label(int f, struct sun_disklabel *slp, int part, off_t start, off_t size
return (-1);
i = write(f, slp, sizeof(*slp));
- if (i < 0)
+ if (i == -1)
err(1, "write modified label");
if (i != sizeof(*slp))
errx(1, "short write modified label");
@@ -297,13 +297,13 @@ append_osfile(int outf, int inf)
while (1) {
len = read(inf, buf, sizeof(buf));
- if (len < 0)
+ if (len == -1)
err(1, "read osfile");
if (len == 0)
return (0);
r = write(outf, buf, len);
- if (r < 0)
+ if (r == -1)
err(1, "write basefile");
if (r != len)
errx(1, "short write basefile");