summaryrefslogtreecommitdiffstats
path: root/channels.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-02-24 05:56:07 +0100
committerDamien Miller <djm@mindrot.org>2014-02-24 05:56:07 +0100
commit0890dc8191bb201eb01c3429feec0300a9d3a930 (patch)
tree429f5dbcaa55812e74b5dfc24fcd43edd921d521 /channels.c
parent - djm@cvs.openbsd.org 2014/02/07 06:55:54 (diff)
downloadopenssh-0890dc8191bb201eb01c3429feec0300a9d3a930.tar.xz
openssh-0890dc8191bb201eb01c3429feec0300a9d3a930.zip
- djm@cvs.openbsd.org 2014/02/15 23:05:36
[channels.c] avoid spurious "getsockname failed: Bad file descriptor" errors in ssh -W; bz#2200, debian#738692 via Colin Watson; ok dtucker@
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/channels.c b/channels.c
index 013accdc4..1052b80ca 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.329 2014/01/31 16:39:19 tedu Exp $ */
+/* $OpenBSD: channels.c,v 1.330 2014/02/15 23:05:36 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1386,7 +1386,7 @@ port_open_helper(Channel *c, char *rtype)
int direct;
char buf[1024];
char *local_ipaddr = get_local_ipaddr(c->sock);
- int local_port = get_sock_port(c->sock, 1);
+ int local_port = c->sock == -1 ? 65536 : get_sock_port(c->sock, 1);
char *remote_ipaddr = get_peer_ipaddr(c->sock);
int remote_port = get_peer_port(c->sock);