=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/channels.c,v retrieving revision 1.297 retrieving revision 1.298 diff -u -r1.297 -r1.298 --- src/usr.bin/ssh/channels.c 2009/10/28 16:38:18 1.297 +++ src/usr.bin/ssh/channels.c 2009/11/10 04:30:44 1.298 @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.297 2009/10/28 16:38:18 reyk Exp $ */ +/* $OpenBSD: channels.c,v 1.298 2009/11/10 04:30:44 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -227,7 +228,12 @@ channel_max_fd = MAX(channel_max_fd, wfd); channel_max_fd = MAX(channel_max_fd, efd); - /* XXX set close-on-exec -markus */ + if (rfd != -1) + fcntl(rfd, F_SETFD, FD_CLOEXEC); + if (wfd != -1 && wfd != rfd) + fcntl(wfd, F_SETFD, FD_CLOEXEC); + if (efd != -1 && efd != rfd && efd != wfd) + fcntl(efd, F_SETFD, FD_CLOEXEC); c->rfd = rfd; c->wfd = wfd;