summaryrefslogtreecommitdiffstats
path: root/nchan.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-10-04 00:10:11 +0000
committerDamien Miller <djm@mindrot.org>2018-10-04 10:44:49 +1000
commitf1dd179e122bdfdb7ca3072d9603607740efda05 (patch)
tree422eb37f82b6fd14e3f8f10668bc3cef8ea447e9 /nchan.c
parent2d1428b11c8b6f616f070f2ecedce12328526944 (diff)
upstream: include a little more information about the status and
disposition of channel's extended (stderr) fd; makes debugging some things a bit easier. No behaviour change. OpenBSD-Commit-ID: 483eb6467dc7d5dbca8eb109c453e7a43075f7ce
Diffstat (limited to 'nchan.c')
-rw-r--r--nchan.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/nchan.c b/nchan.c
index 24929556..da7a9d6d 100644
--- a/nchan.c
+++ b/nchan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nchan.c,v 1.67 2017/09/12 06:35:32 djm Exp $ */
+/* $OpenBSD: nchan.c,v 1.68 2018/10/04 00:10:11 djm Exp $ */
/*
* Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
*
@@ -373,17 +373,23 @@ chan_shutdown_write(struct ssh *ssh, Channel *c)
if (c->type == SSH_CHANNEL_LARVAL)
return;
/* shutdown failure is allowed if write failed already */
- debug2("channel %d: close_write", c->self);
+ debug2("channel %d: %s (i%d o%d sock %d wfd %d efd %d [%s])",
+ c->self, __func__, c->istate, c->ostate, c->sock, c->wfd, c->efd,
+ channel_format_extended_usage(c));
if (c->sock != -1) {
- if (shutdown(c->sock, SHUT_WR) < 0)
- debug2("channel %d: chan_shutdown_write: "
- "shutdown() failed for fd %d: %.100s",
- c->self, c->sock, strerror(errno));
+ if (shutdown(c->sock, SHUT_WR) < 0) {
+ debug2("channel %d: %s: shutdown() failed for "
+ "fd %d [i%d o%d]: %.100s", c->self, __func__,
+ c->sock, c->istate, c->ostate,
+ strerror(errno));
+ }
} else {
- if (channel_close_fd(ssh, &c->wfd) < 0)
- logit("channel %d: chan_shutdown_write: "
- "close() failed for fd %d: %.100s",
- c->self, c->wfd, strerror(errno));
+ if (channel_close_fd(ssh, &c->wfd) < 0) {
+ logit("channel %d: %s: close() failed for "
+ "fd %d [i%d o%d]: %.100s",
+ c->self, __func__, c->wfd, c->istate, c->ostate,
+ strerror(errno));
+ }
}
}
@@ -392,23 +398,27 @@ chan_shutdown_read(struct ssh *ssh, Channel *c)
{
if (c->type == SSH_CHANNEL_LARVAL)
return;
- debug2("channel %d: close_read", c->self);
+ debug2("channel %d: %s (i%d o%d sock %d wfd %d efd %d [%s])",
+ c->self, __func__, c->istate, c->ostate, c->sock, c->rfd, c->efd,
+ channel_format_extended_usage(c));
if (c->sock != -1) {
/*
* shutdown(sock, SHUT_READ) may return ENOTCONN if the
* write side has been closed already. (bug on Linux)
* HP-UX may return ENOTCONN also.
*/
- if (shutdown(c->sock, SHUT_RD) < 0
- && errno != ENOTCONN)
- error("channel %d: chan_shutdown_read: "
- "shutdown() failed for fd %d [i%d o%d]: %.100s",
- c->self, c->sock, c->istate, c->ostate,
- strerror(errno));
+ if (shutdown(c->sock, SHUT_RD) < 0 && errno != ENOTCONN) {
+ error("channel %d: %s: shutdown() failed for "
+ "fd %d [i%d o%d]: %.100s",
+ c->self, __func__, c->sock, c->istate, c->ostate,
+ strerror(errno));
+ }
} else {
- if (channel_close_fd(ssh, &c->rfd) < 0)
- logit("channel %d: chan_shutdown_read: "
- "close() failed for fd %d: %.100s",
- c->self, c->rfd, strerror(errno));
+ if (channel_close_fd(ssh, &c->rfd) < 0) {
+ logit("channel %d: %s: close() failed for "
+ "fd %d [i%d o%d]: %.100s",
+ c->self, __func__, c->rfd, c->istate, c->ostate,
+ strerror(errno));
+ }
}
}