summaryrefslogtreecommitdiff
path: root/svr-main.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2007-01-04 02:01:09 +0000
committerMatt Johnston <matt@ucc.asn.au>2007-01-04 02:01:09 +0000
commite7c57f10623b38b885fc200dfa01fcd91614d94e (patch)
tree516982cbab066e96aa41b889ab607f9e97941ceb /svr-main.c
parent4b426d086cb9a613746fcfecb6f64205afa70bba (diff)
downloaddropbear-e7c57f10623b38b885fc200dfa01fcd91614d94e.tar.gz
Load hostkeys before daemon(), since daemon()'s chdir("/") will prevent us
finding keys in $PWD.
Diffstat (limited to 'svr-main.c')
-rw-r--r--svr-main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/svr-main.c b/svr-main.c
index a14c6e6..e228acf 100644
--- a/svr-main.c
+++ b/svr-main.c
@@ -123,6 +123,10 @@ void main_noinetd() {
int childsock;
int childpipe[2];
+ // Note: commonsetup() must happen before we daemon()ise. Otherwise
+ // daemon() will chdir("/"), and we won't be able to find local-dir hostkeys.
+ commonsetup();
+
/* fork */
if (svr_opts.forkbg) {
int closefds = 0;
@@ -136,8 +140,6 @@ void main_noinetd() {
}
}
- commonsetup();
-
/* should be done after syslog is working */
if (svr_opts.forkbg) {
dropbear_log(LOG_INFO, "Running in background");