Commit Diff


commit - 4398c738bca10e0e884353fb494a23e7d7ac0524
commit + 585362fdeffda23f6ace02652caf7c5b0ecd4759
blob - 8f699ed8dfc370daa7619bed3732d46c81c4c22b
blob + 59fe03f76be46a82ab9cd7fb0b540b1181364a76
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -1932,9 +1932,9 @@ done:
 
 static pid_t
 start_child(enum gotd_procid proc_id, const char *chroot_path,
-    char *argv0, int fd, int daemonize, int verbosity)
+    char *argv0, const char *confpath, int fd, int daemonize, int verbosity)
 {
-	char	*argv[9];
+	char	*argv[11];
 	int	 argc = 0;
 	pid_t	 pid;
 
@@ -1966,6 +1966,9 @@ start_child(enum gotd_procid proc_id, const char *chro
 		fatalx("invalid process id %d", proc_id);
 	}
 
+	argv[argc++] = (char *)"-f";
+	argv[argc++] = (char *)confpath;
+
 	argv[argc++] = (char *)"-P";
 	argv[argc++] = (char *)chroot_path;
 
@@ -1982,8 +1985,8 @@ start_child(enum gotd_procid proc_id, const char *chro
 }
 
 static void
-start_repo_children(struct gotd *gotd, char *argv0, int daemonize,
-    int verbosity)
+start_repo_children(struct gotd *gotd, char *argv0, const char *confpath,
+    int daemonize, int verbosity)
 {
 	struct gotd_repo *repo = NULL;
 	struct gotd_child_proc *proc;
@@ -2015,7 +2018,7 @@ start_repo_children(struct gotd *gotd, char *argv0, in
 		    PF_UNSPEC, proc->pipe) == -1)
 			fatal("socketpair");
 		proc->pid = start_child(proc->type, proc->chroot_path, argv0,
-		    proc->pipe[1], daemonize, verbosity);
+		    confpath, proc->pipe[1], daemonize, verbosity);
 		imsg_init(&proc->iev.ibuf, proc->pipe[0]);
 		log_debug("proc %s %s is on fd %d",
 		    gotd_proc_names[proc->type], proc->chroot_path,
@@ -2167,7 +2170,8 @@ main(int argc, char **argv)
 	if (proc_id == PROC_GOTD) {
 		gotd.pid = getpid();
 		snprintf(title, sizeof(title), "%s", gotd_proc_names[proc_id]);
-		start_repo_children(&gotd, argv0, daemonize, verbosity);
+		start_repo_children(&gotd, argv0, confpath, daemonize,
+		    verbosity);
 		arc4random_buf(&clients_hash_key, sizeof(clients_hash_key));
 		if (daemonize && daemon(0, 0) == -1)
 			fatal("daemon");