[openssh-commits] [openssh] 03/05: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Feb 7 07:53:44 AEDT 2018


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 5069320be93c8b2a6584b9f944c86f60c2b04e48
Author: tb at openbsd.org <tb at openbsd.org>
Date:   Mon Feb 5 05:36:49 2018 +0000

    upstream commit
    
    The file descriptors for socket, stdin, stdout and stderr
    aren't necessarily distinct, so check if they are the same to avoid closing
    the same fd several times.
    
    ok djm
    
    OpenBSD-Commit-ID: 60d71fd22e9a32f5639d4ba6e25a2f417fc36ac1
---
 channels.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/channels.c b/channels.c
index 1c381e0e..bdee1f38 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.378 2018/01/23 05:27:21 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.379 2018/02/05 05:36:49 tb Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -436,10 +436,15 @@ channel_close_fd(struct ssh *ssh, int *fdp)
 static void
 channel_close_fds(struct ssh *ssh, Channel *c)
 {
+	int sock = c->sock, rfd = c->rfd, wfd = c->wfd, efd = c->efd;
+
 	channel_close_fd(ssh, &c->sock);
-	channel_close_fd(ssh, &c->rfd);
-	channel_close_fd(ssh, &c->wfd);
-	channel_close_fd(ssh, &c->efd);
+	if (rfd != sock)
+		channel_close_fd(ssh, &c->rfd);
+	if (wfd != sock && wfd != rfd)
+		channel_close_fd(ssh, &c->wfd);
+	if (efd != sock && efd != rfd && efd != wfd)
+		channel_close_fd(ssh, &c->efd);
 }
 
 static void

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list