diff options
author | djm@openbsd.org <djm@openbsd.org> | 2018-10-04 02:10:11 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-10-04 02:44:49 +0200 |
commit | f1dd179e122bdfdb7ca3072d9603607740efda05 (patch) | |
tree | 422eb37f82b6fd14e3f8f10668bc3cef8ea447e9 /nchan.c | |
parent | upstream: explicit_bzero here to be consistent with other kex*.c; (diff) | |
download | openssh-f1dd179e122bdfdb7ca3072d9603607740efda05.tar.xz openssh-f1dd179e122bdfdb7ca3072d9603607740efda05.zip |
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.c | 52 |
1 files changed, 31 insertions, 21 deletions
@@ -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)); + } } } |