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/diff/diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/diff/diff.c') diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 4c036b82c08..5474199b435 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.66 2019/01/25 00:19:26 millert Exp $ */ +/* $OpenBSD: diff.c,v 1.67 2019/06/28 13:35:00 deraadt Exp $ */ /* * Copyright (c) 2003 Todd C. Miller @@ -253,12 +253,12 @@ main(int argc, char **argv) } else { if (S_ISDIR(stb1.st_mode)) { argv[0] = splice(argv[0], argv[1]); - if (stat(argv[0], &stb1) < 0) + if (stat(argv[0], &stb1) == -1) err(2, "%s", argv[0]); } if (S_ISDIR(stb2.st_mode)) { argv[1] = splice(argv[1], argv[0]); - if (stat(argv[1], &stb2) < 0) + if (stat(argv[1], &stb2) == -1) err(2, "%s", argv[1]); } print_status(diffreg(argv[0], argv[1], dflags), argv[0], argv[1], -- cgit v1.2.3