=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/nchan.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- src/usr.bin/ssh/nchan.c 2019/06/28 13:35:04 1.70 +++ src/usr.bin/ssh/nchan.c 2020/10/18 11:32:01 1.71 @@ -1,4 +1,4 @@ -/* $OpenBSD: nchan.c,v 1.70 2019/06/28 13:35:04 deraadt Exp $ */ +/* $OpenBSD: nchan.c,v 1.71 2020/10/18 11:32:01 djm Exp $ */ /* * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. * @@ -183,12 +183,11 @@ switch (c->istate) { case CHAN_INPUT_WAIT_DRAIN: if (!c->have_remote_id) - fatal("%s: channel %d: no remote_id", - __func__, c->self); + fatal_f("channel %d: no remote_id", c->self); if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_EOF)) != 0 || (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || (r = sshpkt_send(ssh)) != 0) - fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); + fatal_fr(r, "send CHANNEL_EOF"); c->flags |= CHAN_EOF_SENT; break; default: @@ -212,12 +211,11 @@ error("channel %d: already sent close", c->self); } else { if (!c->have_remote_id) - fatal("%s: channel %d: no remote_id", - __func__, c->self); + fatal_f("channel %d: no remote_id", c->self); if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_CLOSE)) != 0 || (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || (r = sshpkt_send(ssh)) != 0) - fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); + fatal_fr(r, "send CHANNEL_EOF"); c->flags |= CHAN_CLOSE_SENT; } } @@ -236,13 +234,13 @@ if (!(datafellows & SSH_NEW_OPENSSH)) return; if (!c->have_remote_id) - fatal("%s: channel %d: no remote_id", __func__, c->self); + fatal_f("channel %d: no remote_id", c->self); if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_REQUEST)) != 0 || (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || (r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0 || (r = sshpkt_put_u8(ssh, 0)) != 0 || (r = sshpkt_send(ssh)) != 0) - fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r)); + fatal_fr(r, "send CHANNEL_EOF"); } /* shared */ @@ -374,22 +372,20 @@ if (c->type == SSH_CHANNEL_LARVAL) return; /* shutdown failure is allowed if write failed already */ - 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, + debug2_f("channel %d: (i%d o%d sock %d wfd %d efd %d [%s])", + c->self, 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) == -1) { - 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)); + debug2_f("channel %d: shutdown() failed for " + "fd %d [i%d o%d]: %.100s", c->self, c->sock, + c->istate, c->ostate, strerror(errno)); } } else { 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)); + logit_f("channel %d: close() failed for " + "fd %d [i%d o%d]: %.100s", c->self, c->wfd, + c->istate, c->ostate, strerror(errno)); } } } @@ -399,22 +395,20 @@ { if (c->type == SSH_CHANNEL_LARVAL) return; - 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, + debug2_f("channel %d: (i%d o%d sock %d wfd %d efd %d [%s])", + c->self, c->istate, c->ostate, c->sock, c->rfd, c->efd, channel_format_extended_usage(c)); if (c->sock != -1) { if (shutdown(c->sock, SHUT_RD) == -1) { - 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)); + error_f("channel %d: shutdown() failed for " + "fd %d [i%d o%d]: %.100s", c->self, c->sock, + c->istate, c->ostate, strerror(errno)); } } else { 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)); + logit_f("channel %d: close() failed for " + "fd %d [i%d o%d]: %.100s", c->self, c->rfd, + c->istate, c->ostate, strerror(errno)); } } } @@ -427,13 +421,12 @@ if (c->extended_usage != CHAN_EXTENDED_READ && c->extended_usage != CHAN_EXTENDED_IGNORE) return; - 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, + debug_f("channel %d: (i%d o%d sock %d wfd %d efd %d [%s])", + c->self, c->istate, c->ostate, c->sock, c->rfd, c->efd, channel_format_extended_usage(c)); if (channel_close_fd(ssh, &c->efd) < 0) { - logit("channel %d: %s: close() failed for " - "extended fd %d [i%d o%d]: %.100s", - c->self, __func__, c->efd, c->istate, c->ostate, - strerror(errno)); + logit_f("channel %d: close() failed for " + "extended fd %d [i%d o%d]: %.100s", c->self, c->efd, + c->istate, c->ostate, strerror(errno)); } }