Mercurial > dropbear
comparison cli-session.c @ 326:d965110e3f5c
add -f background option to dbclient
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 07 Jun 2006 15:47:04 +0000 |
parents | 0e4f225b7e07 |
children | c216212001fc |
comparison
equal
deleted
inserted
replaced
325:0e4f225b7e07 | 326:d965110e3f5c |
---|---|
210 cli_ses.state = SESSION_RUNNING; | 210 cli_ses.state = SESSION_RUNNING; |
211 return; | 211 return; |
212 */ | 212 */ |
213 | 213 |
214 case USERAUTH_SUCCESS_RCVD: | 214 case USERAUTH_SUCCESS_RCVD: |
215 | |
216 if (cli_opts.backgrounded) { | |
217 int devnull; | |
218 // keeping stdin open steals input from the terminal and | |
219 // is confusing, though stdout/stderr could be useful. | |
220 devnull = open(_PATH_DEVNULL, O_RDONLY); | |
221 if (devnull < 0) { | |
222 dropbear_exit("opening /dev/null: %d %s", | |
223 errno, strerror(errno)); | |
224 } | |
225 dup2(devnull, STDIN_FILENO); | |
226 if (daemon(0, 1) < 0) { | |
227 dropbear_exit("Backgrounding failed: %d %s", | |
228 errno, strerror(errno)); | |
229 } | |
230 } | |
231 | |
215 #ifdef ENABLE_CLI_LOCALTCPFWD | 232 #ifdef ENABLE_CLI_LOCALTCPFWD |
216 setup_localtcp(); | 233 setup_localtcp(); |
217 #endif | 234 #endif |
218 #ifdef ENABLE_CLI_REMOTETCPFWD | 235 #ifdef ENABLE_CLI_REMOTETCPFWD |
219 setup_remotetcp(); | 236 setup_remotetcp(); |