diff options
-rw-r--r-- | usr.bin/ssh/ssh.1 | 4 | ||||
-rw-r--r-- | usr.bin/ssh/ssh.c | 16 |
2 files changed, 8 insertions, 12 deletions
diff --git a/usr.bin/ssh/ssh.1 b/usr.bin/ssh/ssh.1 index a793b8c8308..051370ef85f 100644 --- a/usr.bin/ssh/ssh.1 +++ b/usr.bin/ssh/ssh.1 @@ -9,7 +9,7 @@ .\" .\" Created: Sat Apr 22 21:55:14 1995 ylo .\" -.\" $Id: ssh.1,v 1.27 1999/11/22 21:52:41 markus Exp $ +.\" $Id: ssh.1,v 1.28 1999/11/24 20:15:36 markus Exp $ .\" .Dd September 25, 1999 .Dt SSH 1 @@ -293,7 +293,7 @@ disables any escapes and makes the session fully transparent. .It Fl f Requests .Nm -to go to background after authentication. This is useful +to go to background just before command execution. This is useful if .Nm is going to ask for passwords or passphrases, but the user diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index cef5247e7d3..c36eb04f92e 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -11,7 +11,7 @@ */ #include "includes.h" -RCSID("$Id: ssh.c,v 1.33 1999/11/24 19:53:52 markus Exp $"); +RCSID("$Id: ssh.c,v 1.34 1999/11/24 20:15:35 markus Exp $"); #include "xmalloc.h" #include "ssh.h" @@ -592,15 +592,6 @@ main(int ac, char **av) /* Close connection cleanly after attack. */ cipher_attack_detected = packet_disconnect; - /* If requested, fork and let ssh continue in the background. */ - if (fork_after_authentication_flag) { - int ret = fork(); - if (ret == -1) - fatal("fork failed: %.100s", strerror(errno)); - if (ret != 0) - exit(0); - setsid(); - } /* Enable compression if requested. */ if (options.compression) { debug("Requesting compression at level %d.", options.compression_level); @@ -755,6 +746,11 @@ main(int ac, char **av) options.remote_forwards[i].host_port); } + /* If requested, let ssh continue in the background. */ + if (fork_after_authentication_flag) + if (daemon(1, 1) < 0) + fatal("daemon() failed: %.200s", strerror(errno)); + /* * If a command was specified on the command line, execute the * command now. Otherwise request the server to start a shell. |