Download raw body.
gotd: propagate config path to child processes
otherwise they run with default settings and it's not ideal. In particular, for the user. diff /home/op/w/got commit - ad8ccd554bb28e347cf0e997429a408457280182 path + /home/op/w/got blob - 8f699ed8dfc370daa7619bed3732d46c81c4c22b file + gotd/gotd.c --- gotd/gotd.c +++ gotd/gotd.c @@ -1932,9 +1932,9 @@ start_child(enum gotd_procid proc_id, const char *chro 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 *conf, 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 *)conf; + argv[argc++] = (char *)"-P"; argv[argc++] = (char *)chroot_path; @@ -1982,8 +1985,8 @@ start_repo_children(struct gotd *gotd, char *argv0, in } static void -start_repo_children(struct gotd *gotd, char *argv0, int daemonize, - int verbosity) +start_repo_children(struct gotd *gotd, char *argv0, const char *conf, + 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); + conf, 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");
gotd: propagate config path to child processes