=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/ssh.c,v retrieving revision 1.592 retrieving revision 1.593 diff -u -r1.592 -r1.593 --- src/usr.bin/ssh/ssh.c 2023/07/17 05:41:53 1.592 +++ src/usr.bin/ssh/ssh.c 2023/07/26 23:06:00 1.593 @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.592 2023/07/17 05:41:53 jmc Exp $ */ +/* $OpenBSD: ssh.c,v 1.593 2023/07/26 23:06:00 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -114,10 +114,11 @@ * Flag indicating that the current process should be backgrounded and * a new mux-client launched in the foreground for ControlPersist. */ -int need_controlpersist_detach = 0; +static int need_controlpersist_detach = 0; /* Copies of flags for ControlPersist foreground mux-client */ -int ostdin_null_flag, osession_type, otty_flag, orequest_tty; +static int ostdin_null_flag, osession_type, otty_flag, orequest_tty; +static int ofork_after_authentication; /* * General data structure for command line options and options configurable @@ -1736,11 +1737,15 @@ /* Child: master process continues mainloop */ break; default: - /* Parent: set up mux client to connect to backgrounded master */ + /* + * Parent: set up mux client to connect to backgrounded + * master. + */ debug2_f("background process is %ld", (long)pid); options.stdin_null = ostdin_null_flag; options.request_tty = orequest_tty; tty_flag = otty_flag; + options.fork_after_authentication = ofork_after_authentication; options.session_type = osession_type; close(muxserver_sock); muxserver_sock = -1; @@ -2152,11 +2157,11 @@ osession_type = options.session_type; orequest_tty = options.request_tty; otty_flag = tty_flag; + ofork_after_authentication = options.fork_after_authentication; options.stdin_null = 1; options.session_type = SESSION_TYPE_NONE; tty_flag = 0; - if (!options.fork_after_authentication && - (osession_type != SESSION_TYPE_NONE || + if ((osession_type != SESSION_TYPE_NONE || options.stdio_forward_host != NULL)) need_controlpersist_detach = 1; options.fork_after_authentication = 1;