From 61656abc7ff84215165af1bd464bc053b3b66158 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 28 Jun 2019 13:35:06 +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. --- usr.bin/biff/biff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/biff') diff --git a/usr.bin/biff/biff.c b/usr.bin/biff/biff.c index 9a43b6f8e68..f8c102f5dfc 100644 --- a/usr.bin/biff/biff.c +++ b/usr.bin/biff/biff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biff.c,v 1.16 2018/08/11 10:59:34 mestre Exp $ */ +/* $OpenBSD: biff.c,v 1.17 2019/06/28 13:35:00 deraadt Exp $ */ /* $NetBSD: biff.c,v 1.3 1995/03/26 02:34:22 glass Exp $ */ /* @@ -78,11 +78,11 @@ main(int argc, char *argv[]) switch(argv[0][0]) { case 'n': - if (chmod(name, sb.st_mode & ~S_IXUSR) < 0) + if (chmod(name, sb.st_mode & ~S_IXUSR) == -1) err(2, "%s", name); break; case 'y': - if (chmod(name, sb.st_mode | S_IXUSR) < 0) + if (chmod(name, sb.st_mode | S_IXUSR) == -1) err(2, "%s", name); break; default: -- cgit v1.2.3