From: David Woodhouse Date: Fri, 4 Jan 2019 14:31:30 +0000 (+0000) Subject: Fix order of dup2 args in spawning TNCC, and add comments X-Git-Tag: v8.00~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=596efa65f68d38b062a22442aa63da5a1522abab;p=users%2Fdwmw2%2Fopenconnect.git Fix order of dup2 args in spawning TNCC, and add comments Reported-by: Daniel Lenski Signed-off-by: David Woodhouse --- diff --git a/auth-juniper.c b/auth-juniper.c index 538dfd80..75dd78d3 100644 --- a/auth-juniper.c +++ b/auth-juniper.c @@ -396,8 +396,10 @@ static int tncc_preauth(struct openconnect_info *vpninfo) close(sockfd[1]); /* The duplicated fd does not have O_CLOEXEC */ dup2(sockfd[0], 0); - /* We really don't want anything going to stdout */ - dup2(1, 2); + /* We really don't want anything going to our stdout. + Redirect the child's stdout, to our stderr. */ + dup2(2, 1); + /* And close everything else.*/ for (i = 3; i < 1024 ; i++) close(i);