From 596efa65f68d38b062a22442aa63da5a1522abab Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 4 Jan 2019 14:31:30 +0000 Subject: [PATCH] Fix order of dup2 args in spawning TNCC, and add comments Reported-by: Daniel Lenski Signed-off-by: David Woodhouse --- auth-juniper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); -- 2.50.1