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 /mux.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 'mux.c')
-rw-r--r-- | mux.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.79 2019/01/19 21:35:25 djm Exp $ */ +/* $OpenBSD: mux.c,v 1.80 2019/06/28 13:35:04 deraadt Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> * @@ -1492,7 +1492,7 @@ mux_client_read(int fd, struct sshbuf *b, size_t need) return -1; } len = read(fd, p + have, need - have); - if (len < 0) { + if (len == -1) { switch (errno) { #if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN) case EWOULDBLOCK: @@ -1541,7 +1541,7 @@ mux_client_write_packet(int fd, struct sshbuf *m) return -1; } len = write(fd, ptr + have, need - have); - if (len < 0) { + if (len == -1) { switch (errno) { #if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN) case EWOULDBLOCK: @@ -2324,7 +2324,7 @@ muxclient(const char *path) fatal("ControlPath too long ('%s' >= %u bytes)", path, (unsigned int)sizeof(addr.sun_path)); - if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) + if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) fatal("%s socket(): %s", __func__, strerror(errno)); if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) { |