]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix order of dup2 args in spawning TNCC, and add comments
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 4 Jan 2019 14:31:30 +0000 (14:31 +0000)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 4 Jan 2019 14:31:30 +0000 (14:31 +0000)
Reported-by: Daniel Lenski <dlenski@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
auth-juniper.c

index 538dfd804e902d738685eb446a29fcb2f74e85d7..75dd78d33c9e4e79920c763b4c5f39c6c8b58179 100644 (file)
@@ -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);