summaryrefslogtreecommitdiff
path: root/sbin/kbd
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 /sbin/kbd
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 'sbin/kbd')
-rw-r--r--sbin/kbd/kbd_wscons.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/kbd/kbd_wscons.c b/sbin/kbd/kbd_wscons.c
index 11828bdcb23..af25d2d0ffa 100644
--- a/sbin/kbd/kbd_wscons.c
+++ b/sbin/kbd/kbd_wscons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd_wscons.c,v 1.32 2016/10/03 13:03:49 jca Exp $ */
+/* $OpenBSD: kbd_wscons.c,v 1.33 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2001 Mats O Jansson. All rights reserved.
@@ -136,7 +136,7 @@ kbd_get_encs(int fd, struct wskbd_encoding_data *encs)
encs->nencodings, sizeof(kbd_t));
if (encs->encodings == NULL)
err(1, NULL);
- if (ioctl(fd, WSKBDIO_GETENCODINGS, encs) < 0)
+ if (ioctl(fd, WSKBDIO_GETENCODINGS, encs) == -1)
err(1, "WSKBDIO_GETENCODINGS");
if (encs->nencodings == nencodings) {
nencodings *= 2;
@@ -160,10 +160,10 @@ kbd_list(void)
for (i = 0; i < NUM_KBD; i++) {
(void) snprintf(device, sizeof device, "/dev/wskbd%d", i);
fd = open(device, O_WRONLY);
- if (fd < 0)
+ if (fd == -1)
fd = open(device, O_RDONLY);
if (fd >= 0) {
- if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) < 0)
+ if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) == -1)
err(1, "WSKBDIO_GTYPE");
switch (kbtype) {
case WSKBD_TYPE_PC_XT:
@@ -258,10 +258,10 @@ kbd_set(char *name, int verbose)
for (i = 0; i < NUM_KBD; i++) {
(void) snprintf(device, sizeof device, "/dev/wskbd%d", i);
fd = open(device, O_WRONLY);
- if (fd < 0)
+ if (fd == -1)
fd = open(device, O_RDONLY);
if (fd >= 0) {
- if (ioctl(fd, WSKBDIO_SETENCODING, &map) < 0) {
+ if (ioctl(fd, WSKBDIO_SETENCODING, &map) == -1) {
if (errno == EINVAL) {
fprintf(stderr,
"%s: unsupported encoding %s on %s\n",