From 86ffccf24f66032a89d70a32b3609584c0db7345 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 28 Jun 2019 13:32:54 +0000 Subject: 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. --- libexec/rpc.rusersd/rusers_proc.c | 4 ++-- libexec/rpc.rusersd/rusersd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libexec/rpc.rusersd') diff --git a/libexec/rpc.rusersd/rusers_proc.c b/libexec/rpc.rusersd/rusers_proc.c index 1f4831d4767..1f3ea756f18 100644 --- a/libexec/rpc.rusersd/rusers_proc.c +++ b/libexec/rpc.rusersd/rusers_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rusers_proc.c,v 1.26 2017/04/27 21:28:00 millert Exp $ */ +/* $OpenBSD: rusers_proc.c,v 1.27 2019/06/28 13:32:53 deraadt Exp $ */ /*- * Copyright (c) 1993 John Brezak @@ -80,7 +80,7 @@ getidle(char *tty, int len) snprintf(devname, sizeof devname, "%s/%.*s", _PATH_DEV, len, tty); - if (stat(devname, &st) < 0) { + if (stat(devname, &st) == -1) { #ifdef DEBUG printf("%s: %m\n", devname); #endif diff --git a/libexec/rpc.rusersd/rusersd.c b/libexec/rpc.rusersd/rusersd.c index 7b9a36fb21d..6b28bb5c581 100644 --- a/libexec/rpc.rusersd/rusersd.c +++ b/libexec/rpc.rusersd/rusersd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rusersd.c,v 1.20 2018/04/26 12:42:51 guenther Exp $ */ +/* $OpenBSD: rusersd.c,v 1.21 2019/06/28 13:32:53 deraadt Exp $ */ /*- * Copyright (c) 1993 John Brezak @@ -94,7 +94,7 @@ main(int argc, char *argv[]) * See if inetd started us */ fromlen = sizeof(from); - if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) { + if (getsockname(0, (struct sockaddr *)&from, &fromlen) == -1) { from_inetd = 0; sock = RPC_ANYSOCK; proto = IPPROTO_UDP; -- cgit v1.2.3