"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: gotd: propagate config path to child processes
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 31 Oct 2022 17:14:49 +0100

Download raw body.

Thread
On Mon, Oct 31, 2022 at 04:09:42PM +0100, Omar Polo wrote:
> otherwise they run with default settings and it's not ideal.  In
> particular, for the user.

> @@ -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)

Thanks! I would keep using the name 'confpath' instead of 'conf',
for consistency. But ok either way.

>  {
>  	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");
> 
>