mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
add -f background option to dbclient
--HG-- extra : convert_revision : 5ef61c30c0a634ac0da22a8c694ce235690e8170
This commit is contained in:
@@ -212,6 +212,23 @@ static void cli_sessionloop() {
|
||||
*/
|
||||
|
||||
case USERAUTH_SUCCESS_RCVD:
|
||||
|
||||
if (cli_opts.backgrounded) {
|
||||
int devnull;
|
||||
// keeping stdin open steals input from the terminal and
|
||||
// is confusing, though stdout/stderr could be useful.
|
||||
devnull = open(_PATH_DEVNULL, O_RDONLY);
|
||||
if (devnull < 0) {
|
||||
dropbear_exit("opening /dev/null: %d %s",
|
||||
errno, strerror(errno));
|
||||
}
|
||||
dup2(devnull, STDIN_FILENO);
|
||||
if (daemon(0, 1) < 0) {
|
||||
dropbear_exit("Backgrounding failed: %d %s",
|
||||
errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_CLI_LOCALTCPFWD
|
||||
setup_localtcp();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user