summaryrefslogtreecommitdiff
path: root/usr.sbin/wsfontload/wsfontload.c
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/wsfontload/wsfontload.c
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/wsfontload/wsfontload.c')
-rw-r--r--usr.sbin/wsfontload/wsfontload.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/wsfontload/wsfontload.c b/usr.sbin/wsfontload/wsfontload.c
index 97f2242220e..1cdc1bf50af 100644
--- a/usr.sbin/wsfontload/wsfontload.c
+++ b/usr.sbin/wsfontload/wsfontload.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsfontload.c,v 1.20 2017/08/23 09:15:33 fcambus Exp $ */
+/* $OpenBSD: wsfontload.c,v 1.21 2019/06/28 13:32:51 deraadt Exp $ */
/* $NetBSD: wsfontload.c,v 1.2 2000/01/05 18:46:43 ad Exp $ */
/*
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
usage();
wsfd = open(wsdev, O_RDWR, 0);
- if (wsfd < 0)
+ if (wsfd == -1)
err(2, "open %s", wsdev);
if (list) {
@@ -167,7 +167,7 @@ main(int argc, char *argv[])
if (argc > 0) {
infile = argv[0];
ffd = open(infile, O_RDONLY, 0);
- if (ffd < 0)
+ if (ffd == -1)
err(4, "open %s", infile);
if (!*f.name)
strlcpy(f.name, infile, WSFONT_NAME_SIZE);
@@ -229,7 +229,7 @@ main(int argc, char *argv[])
if (!buf)
errx(1, "malloc");
res = read(ffd, buf, len);
- if (res < 0)
+ if (res == -1)
err(4, "read %s", infile);
if (res != len)
errx(4, "short read on %s", infile);
@@ -237,7 +237,7 @@ main(int argc, char *argv[])
f.data = buf;
res = ioctl(wsfd, WSDISPLAYIO_LDFONT, &f);
- if (res < 0)
+ if (res == -1)
err(3, "WSDISPLAYIO_LDFONT");
return (0);