diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
commit | 61656abc7ff84215165af1bd464bc053b3b66158 (patch) | |
tree | c7eabb0c4fa9faa024e724e99c240c40da07ca42 /usr.bin/diff/diff.c | |
parent | 18603ebf99fbb890ae9666cb0c4aa9f879e7edaa (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.bin/diff/diff.c')
-rw-r--r-- | usr.bin/diff/diff.c | 6 |
1 files changed, 3 insertions, 3 deletions
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 <millert@openbsd.org> @@ -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], |