From: Stefan Sperling Subject: Re: move gotd_child_proc struct in gotd.c To: Omar Polo Cc: gameoftrees@openbsd.org Date: Thu, 22 Jun 2023 13:33:39 +0200 On Thu, Jun 22, 2023 at 12:03:27PM +0200, Omar Polo wrote: > I'm splitting the diff I sent yesterday into more manegeable bits. > > This is not strictly needed, but sice the struct gotd_child_proc is > not used outside of gotd.c, let's move it there and allocate > dynamically listen_proc in gotd. > > While here, I'm also dropping the `nhelpers' field which seems > currently unused. OK, but please free listener proc memory explicitly in gotd_shutdown(): > @@ -753,7 +762,7 @@ gotd_shutdown(void) > disconnect(c); > } > > - proc = &gotd.listen_proc; > + proc = gotd.listen_proc; > msgbuf_clear(&proc->iev.ibuf.w); > close(proc->iev.ibuf.fd); > kill_proc(proc, 0); wait_for_child(proc->pid); free(proc);