diff options
author | deraadt@openbsd.org <deraadt@openbsd.org> | 2019-06-28 15:35:04 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-07-05 03:10:39 +0200 |
commit | 4d28fa78abce2890e136281950633fae2066cc29 (patch) | |
tree | 33226ec64ced661bb7e40005e30744b68fa59a80 /canohost.c | |
parent | upstream: asprintf returns -1, not an arbitrary value < 0. Also (diff) | |
download | openssh-4d28fa78abce2890e136281950633fae2066cc29.tar.xz openssh-4d28fa78abce2890e136281950633fae2066cc29.zip |
upstream: 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.
OpenBSD-Commit-ID: 48081f00db7518e3b712a49dca06efc2a5428075
Diffstat (limited to 'canohost.c')
-rw-r--r-- | canohost.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/canohost.c b/canohost.c index f71a08568..abea9c6e6 100644 --- a/canohost.c +++ b/canohost.c @@ -1,4 +1,4 @@ -/* $OpenBSD: canohost.c,v 1.73 2016/03/07 19:02:43 djm Exp $ */ +/* $OpenBSD: canohost.c,v 1.74 2019/06/28 13:35:04 deraadt Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -164,12 +164,12 @@ get_sock_port(int sock, int local) fromlen = sizeof(from); memset(&from, 0, sizeof(from)); if (local) { - if (getsockname(sock, (struct sockaddr *)&from, &fromlen) < 0) { + if (getsockname(sock, (struct sockaddr *)&from, &fromlen) == -1) { error("getsockname failed: %.100s", strerror(errno)); return 0; } } else { - if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) { + if (getpeername(sock, (struct sockaddr *)&from, &fromlen) == -1) { debug("getpeername failed: %.100s", strerror(errno)); return -1; } |