|
Lines 1343-1349
main(int ac, char **av)
Link Here
|
| 1343 |
struct ssh *ssh = NULL; |
1343 |
struct ssh *ssh = NULL; |
| 1344 |
extern char *optarg; |
1344 |
extern char *optarg; |
| 1345 |
extern int optind; |
1345 |
extern int optind; |
| 1346 |
int r, opt, i, j, on = 1; |
1346 |
int r, opt, i, j, on = 1, already_daemon; |
| 1347 |
int sock_in = -1, sock_out = -1, newsock = -1; |
1347 |
int sock_in = -1, sock_out = -1, newsock = -1; |
| 1348 |
const char *remote_ip; |
1348 |
const char *remote_ip; |
| 1349 |
int remote_port; |
1349 |
int remote_port; |
|
Lines 1802-1812
main(int ac, char **av)
Link Here
|
| 1802 |
log_init(__progname, options.log_level, options.log_facility, log_stderr); |
1802 |
log_init(__progname, options.log_level, options.log_facility, log_stderr); |
| 1803 |
|
1803 |
|
| 1804 |
/* |
1804 |
/* |
| 1805 |
* If not in debugging mode, and not started from inetd, disconnect |
1805 |
* If not in debugging mode, not started from inetd and not already |
| 1806 |
* from the controlling terminal, and fork. The original process |
1806 |
* daemonized (eg re-exec via SIGHUP), disconnect from the controlling |
| 1807 |
* exits. |
1807 |
* terminal, and fork. The original process exits. |
| 1808 |
*/ |
1808 |
*/ |
| 1809 |
if (!(debug_flag || inetd_flag || no_daemon_flag)) { |
1809 |
already_daemon = daemonized(); |
|
|
1810 |
if (!(debug_flag || inetd_flag || no_daemon_flag || already_daemon)) { |
| 1810 |
#ifdef TIOCNOTTY |
1811 |
#ifdef TIOCNOTTY |
| 1811 |
int fd; |
1812 |
int fd; |
| 1812 |
#endif /* TIOCNOTTY */ |
1813 |
#endif /* TIOCNOTTY */ |
|
Lines 1849-1855
main(int ac, char **av)
Link Here
|
| 1849 |
* Write out the pid file after the sigterm handler |
1850 |
* Write out the pid file after the sigterm handler |
| 1850 |
* is setup and the listen sockets are bound |
1851 |
* is setup and the listen sockets are bound |
| 1851 |
*/ |
1852 |
*/ |
| 1852 |
if (options.pid_file != NULL && !debug_flag) { |
1853 |
if (options.pid_file != NULL && !debug_flag && !already_daemon) { |
| 1853 |
FILE *f = fopen(options.pid_file, "w"); |
1854 |
FILE *f = fopen(options.pid_file, "w"); |
| 1854 |
|
1855 |
|
| 1855 |
if (f == NULL) { |
1856 |
if (f == NULL) { |