diff 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
line wrap: on
line diff
--- a/svr-main.c	Sat Feb 03 08:09:55 2007 +0000
+++ b/svr-main.c	Sat Feb 03 08:20:30 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");