[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 3/5] console-client: replace function epilogue with console_exit



Quoting Neal H. Walfield (2013-10-10 19:24:32)
> At Thu, 10 Oct 2013 18:08:20 +0200,
> Justus Winter wrote:
> > 
> > * console-client/console.c (main): Replace epilogue with console_exit.
> > ---
> >  console-client/console.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/console-client/console.c b/console-client/console.c
> > index a9f8368..4046cf3 100644
> > --- a/console-client/console.c
> > +++ b/console-client/console.c
> > @@ -745,6 +745,5 @@ main (int argc, char *argv[])
> >    cons_server_loop ();
> >  
> >    /* Never reached.  */
> > -  driver_fini ();
> > -  return 0;
> > +  console_exit ();
> 
> Do you need to remove the comment too?

No, cons_server_loop shouldn't ever return. I propose the change
mainly for aesthetic reasons. Formerly, the main functions epilogue
was identical to the console_exit function. I added the
daemon_pid_file_remove stuff to console_exit, breaking the
symmetry. By marking console_exit with noreturn, replacing the
epilogue with the return statement with console_exit should be fine
compiler-warning wise. Furthermore, if the code is ever changed so
that cons_server_loop does return, all cleanups will be performed.

Justus


Reply to: