comparison svr-main.c @ 415:8b9aba1d5fa4 channel-fix

merge of '73fe066c5d9e2395354ba74756124d45c978a04d' and 'f5014cc84558f1e8eba42dbecf9f72f94bfe6134'
author Matt Johnston <matt@ucc.asn.au>
date Tue, 06 Feb 2007 16:00:18 +0000
parents b66a00272a90
children 1afa503e33f5
comparison
equal deleted inserted replaced
414:c53a26c430e5 415:8b9aba1d5fa4
121 char * preauth_addrs[MAX_UNAUTH_CLIENTS]; 121 char * preauth_addrs[MAX_UNAUTH_CLIENTS];
122 122
123 int childsock; 123 int childsock;
124 int childpipe[2]; 124 int childpipe[2];
125 125
126 // Note: commonsetup() must happen before we daemon()ise. Otherwise
127 // daemon() will chdir("/"), and we won't be able to find local-dir hostkeys.
128 commonsetup();
129
126 /* fork */ 130 /* fork */
127 if (svr_opts.forkbg) { 131 if (svr_opts.forkbg) {
128 int closefds = 0; 132 int closefds = 0;
129 #ifndef DEBUG_TRACE 133 #ifndef DEBUG_TRACE
130 if (!svr_opts.usingsyslog) { 134 if (!svr_opts.usingsyslog) {
133 #endif 137 #endif
134 if (daemon(0, closefds) < 0) { 138 if (daemon(0, closefds) < 0) {
135 dropbear_exit("Failed to daemonize: %s", strerror(errno)); 139 dropbear_exit("Failed to daemonize: %s", strerror(errno));
136 } 140 }
137 } 141 }
138
139 commonsetup();
140 142
141 /* should be done after syslog is working */ 143 /* should be done after syslog is working */
142 if (svr_opts.forkbg) { 144 if (svr_opts.forkbg) {
143 dropbear_log(LOG_INFO, "Running in background"); 145 dropbear_log(LOG_INFO, "Running in background");
144 } else { 146 } else {