summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mksuncd
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
committerderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
commitdf69c215c7c66baf660f3f65414fd34796c96152 (patch)
tree0255639162b24c4a2f761a274e32b69c2256fd45 /usr.sbin/mksuncd
parentminiroot prototype disklabels should attempt to contain accurate (diff)
downloadwireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.tar.xz
wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.zip
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");