summaryrefslogtreecommitdiff
path: root/nchan.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2019-06-28 13:35:04 +0000
committerDamien Miller <djm@mindrot.org>2019-07-05 11:10:39 +1000
commit4d28fa78abce2890e136281950633fae2066cc29 (patch)
tree33226ec64ced661bb7e40005e30744b68fa59a80 /nchan.c
parente8c974043c1648eab0ad67a7ba6a3e444fe79d2d (diff)
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 'nchan.c')
-rw-r--r--nchan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nchan.c b/nchan.c
index 8294d7fca..1e96eb641 100644
--- a/nchan.c
+++ b/nchan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: nchan.c,v 1.69 2018/10/04 07:47:35 djm Exp $ */ 1/* $OpenBSD: nchan.c,v 1.70 2019/06/28 13:35:04 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. 3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
4 * 4 *
@@ -380,7 +380,7 @@ chan_shutdown_write(struct ssh *ssh, Channel *c)
380 c->self, __func__, c->istate, c->ostate, c->sock, c->wfd, c->efd, 380 c->self, __func__, c->istate, c->ostate, c->sock, c->wfd, c->efd,
381 channel_format_extended_usage(c)); 381 channel_format_extended_usage(c));
382 if (c->sock != -1) { 382 if (c->sock != -1) {
383 if (shutdown(c->sock, SHUT_WR) < 0) { 383 if (shutdown(c->sock, SHUT_WR) == -1) {
384 debug2("channel %d: %s: shutdown() failed for " 384 debug2("channel %d: %s: shutdown() failed for "
385 "fd %d [i%d o%d]: %.100s", c->self, __func__, 385 "fd %d [i%d o%d]: %.100s", c->self, __func__,
386 c->sock, c->istate, c->ostate, 386 c->sock, c->istate, c->ostate,
@@ -410,7 +410,7 @@ chan_shutdown_read(struct ssh *ssh, Channel *c)
410 * write side has been closed already. (bug on Linux) 410 * write side has been closed already. (bug on Linux)
411 * HP-UX may return ENOTCONN also. 411 * HP-UX may return ENOTCONN also.
412 */ 412 */
413 if (shutdown(c->sock, SHUT_RD) < 0 && errno != ENOTCONN) { 413 if (shutdown(c->sock, SHUT_RD) == -1 && errno != ENOTCONN) {
414 error("channel %d: %s: shutdown() failed for " 414 error("channel %d: %s: shutdown() failed for "
415 "fd %d [i%d o%d]: %.100s", 415 "fd %d [i%d o%d]: %.100s",
416 c->self, __func__, c->sock, c->istate, c->ostate, 416 c->self, __func__, c->sock, c->istate, c->ostate,