[PATCH] ui/ncurses: Spin child to ensure autoboot cancelled on exit

Jeremy Kerr jk at ozlabs.org
Wed Nov 23 14:52:06 AEDT 2016


Hi Sam,

In the title, did you mean "Spin child" or "Spawn child"?

> 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?

Cheers,


Jeremy


More information about the Petitboot mailing list