diff 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
line wrap: on
line diff
--- a/svr-main.c	Tue Feb 06 15:59:54 2007 +0000
+++ b/svr-main.c	Tue Feb 06 16:00:18 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");