comparison svr-main.c @ 398:59c7938af2bd

merge of '1250b8af44b62d8f4fe0f8d9fc7e7a1cc34e7e1c' and '7f8670ac3bb975f40967f3979d09d2199b7e90c8'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:20:30 +0000
parents b66a00272a90
children 1afa503e33f5
comparison
equal deleted inserted replaced
396:e7c1a77d2921 398:59c7938af2bd
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 {