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/ntpd | |
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/ntpd')
-rw-r--r-- | usr.sbin/ntpd/constraint.c | 6 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/ntpd/constraint.c b/usr.sbin/ntpd/constraint.c index f1af7fa602a..f478ec789e9 100644 --- a/usr.sbin/ntpd/constraint.c +++ b/usr.sbin/ntpd/constraint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: constraint.c,v 1.46 2019/06/16 07:36:25 otto Exp $ */ +/* $OpenBSD: constraint.c,v 1.47 2019/06/28 13:32:49 deraadt Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -955,7 +955,7 @@ httpsdate_request(struct httpsdate *httpsdate, struct timeval *when) ret = tls_write(httpsdate->tls_ctx, buf, len); if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) continue; - if (ret < 0) { + if (ret == -1) { log_warnx("tls write failed: %s (%s): %s", httpsdate->tls_addr, httpsdate->tls_hostname, tls_error(httpsdate->tls_ctx)); @@ -1091,7 +1091,7 @@ tls_readline(struct tls *tls, size_t *lenp, size_t *maxlength, ret = tls_read(tls, &c, 1); if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) goto again; - if (ret < 0) { + if (ret == -1) { /* SSL read error, ignore */ free(buf); return (NULL); diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c index 33037db8464..ef1b43e133a 100644 --- a/usr.sbin/ntpd/ntpd.c +++ b/usr.sbin/ntpd/ntpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.c,v 1.123 2019/06/27 15:18:42 otto Exp $ */ +/* $OpenBSD: ntpd.c,v 1.124 2019/06/28 13:32:49 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -111,7 +111,7 @@ auto_preconditions(const struct ntpd_conf *cnf) int constraints, securelevel; size_t sz = sizeof(int); - if (sysctl(mib, 2, &securelevel, &sz, NULL, 0) < 0) + if (sysctl(mib, 2, &securelevel, &sz, NULL, 0) == -1) err(1, "sysctl"); constraints = !TAILQ_EMPTY(&cnf->constraints); return !cnf->settime && constraints && securelevel == 0; |