diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
commit | 86ffccf24f66032a89d70a32b3609584c0db7345 (patch) | |
tree | 2ae97fac6ea5be57cc953baf8612e8f683da0172 /usr.sbin/cron/crontab.c | |
parent | ce9fea47562d4f179d45680d6aec00ede2877141 (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.sbin/cron/crontab.c')
-rw-r--r-- | usr.sbin/cron/crontab.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index d22aae2538d..6e9933af6cc 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crontab.c,v 1.92 2016/01/11 14:23:50 millert Exp $ */ +/* $OpenBSD: crontab.c,v 1.93 2019/06/28 13:32:47 deraadt Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -199,11 +199,11 @@ parse_args(int argc, char *argv[]) * the race. */ - if (setegid(user_gid) < 0) + if (setegid(user_gid) == -1) err(EXIT_FAILURE, "setegid(user_gid)"); if (!(NewCrontab = fopen(Filename, "r"))) err(EXIT_FAILURE, "%s", Filename); - if (setegid(crontab_gid) < 0) + if (setegid(crontab_gid) == -1) err(EXIT_FAILURE, "setegid(crontab_gid)"); } } @@ -279,7 +279,7 @@ edit_cmd(void) err(EXIT_FAILURE, _PATH_DEVNULL); } - if (fstat(fileno(f), &statbuf) < 0) { + if (fstat(fileno(f), &statbuf) == -1) { warn("fstat"); goto fatal; } @@ -310,7 +310,7 @@ edit_cmd(void) copy_crontab(f, NewCrontab); fclose(f); - if (fflush(NewCrontab) < 0) + if (fflush(NewCrontab) == EOF) err(EXIT_FAILURE, "%s", Filename); if (futimens(t, ts) == -1) warn("unable to set times on %s", Filename); @@ -335,7 +335,7 @@ edit_cmd(void) goto fatal; } - if (fstat(t, &statbuf) < 0) { + if (fstat(t, &statbuf) == -1) { warn("fstat"); goto fatal; } |