diff svr-main.c @ 379:b66a00272a90

Load hostkeys before daemon(), since daemon()'s chdir("/") will prevent us finding keys in $PWD.
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jan 2007 02:01:09 +0000
parents 3bfbe95f9a14
children 1afa503e33f5
line wrap: on
line diff
--- a/svr-main.c	Wed Dec 06 13:11:41 2006 +0000
+++ b/svr-main.c	Thu Jan 04 02:01:09 2007 +0000
@@ -123,6 +123,10 @@
 	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 @@
 		}
 	}
 
-	commonsetup();
-
 	/* should be done after syslog is working */
 	if (svr_opts.forkbg) {
 		dropbear_log(LOG_INFO, "Running in background");