[PATCH] ui/ncurses: Spin child to ensure autoboot cancelled on exit
Samuel Mendoza-Jonas
sam at mendozajonas.com
Wed Nov 23 14:54:47 AEDT 2016
On Wed, 2016-11-23 at 11:52 +0800, Jeremy Kerr wrote:
> Hi Sam,
>
> In the title, did you mean "Spin child" or "Spawn child"?
Spin, but Spawn also works.. I'll stare at that bikeshed for a bit :)
>
> > If the client is not connected to the server instance when exiting, fork
> > and have the child process spin until the server is available and can be
> > told to cancel autoboot. This prevents the scenario of a user exiting
> > the UI and having the server continue to autoboot while they are using
> > the command line.
>
> Looks good, and solves a long-standing nit.
>
> One minor thing (below), but regardless:
>
> Acked-by: Jeremy Kerr <jk at ozlabs.org>
>
>
> > @@ -1104,5 +1138,14 @@ int cui_run(struct cui *cui)
> >
> > cui_atexit();
> >
> > + if (!cui->client) {
> > + /* Fork a child to tell the server to cancel autoboot */
> > + pid = fork();
> > + if (!pid)
> > + cui_server_wait_on_exit(cui);
> > + if (pid < 0)
> > + pb_log("Failed to fork child on exit: %m\n");
> > + }
> > +
>
> Can we move the exit() to here, rather than cui_server_wait_on_exit(),
> so that it's super obvious that the forked child cannot continue
> executing cui_run?
Ah good point, will do.
>
> Cheers,
>
>
> Jeremy
> _______________________________________________
> Petitboot mailing list
> Petitboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/petitboot
More information about the Petitboot
mailing list