summaryrefslogtreecommitdiff
path: root/usr.bin/last
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:35:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:35:06 +0000
commit61656abc7ff84215165af1bd464bc053b3b66158 (patch)
treec7eabb0c4fa9faa024e724e99c240c40da07ca42 /usr.bin/last
parent18603ebf99fbb890ae9666cb0c4aa9f879e7edaa (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/last')
-rw-r--r--usr.bin/last/last.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index 99f850222b3..98688a7bbcf 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: last.c,v 1.51 2018/08/03 15:01:28 deraadt Exp $ */
+/* $OpenBSD: last.c,v 1.52 2019/06/28 13:35:01 deraadt Exp $ */
/* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
/*
@@ -254,7 +254,7 @@ wtmp(void)
off_t bl;
struct ttytab *T;
- if ((wfd = open(file, O_RDONLY, 0)) < 0 || fstat(wfd, &stb) == -1)
+ if ((wfd = open(file, O_RDONLY, 0)) == -1 || fstat(wfd, &stb) == -1)
err(1, "%s", file);
bl = (stb.st_size + sizeof(buf) - 1) / sizeof(buf);
@@ -558,7 +558,7 @@ dateconv(char *arg)
char *p;
/* Start with the current time. */
- if (time(&timet) < 0)
+ if (time(&timet) == -1)
err(1, "time");
if ((t = localtime(&timet)) == NULL)
err(1, "localtime");