[ovs-dev] [PATCH 08/11] ovn-nbctl: Propagate error thru the context.

Jakub Sitnicki jkbs at redhat.com
Tue Jul 24 13:13:44 UTC 2018


On Mon, 23 Jul 2018 15:36:28 -0700
Ben Pfaff <blp at ovn.org> wrote:

> On Tue, Jul 17, 2018 at 03:34:12PM +0200, Jakub Sitnicki wrote:
> > Instead of dying let the main loop handle the error.
> > This will allow us to report errors when running in daemon mode.
> > 
> > This is a result of applying the following semantic patch:
> > 
> > @@
> > identifier F;
> > identifier C;
> > identifier E;
> > @@
> >   static void F(struct ctl_context *C) {
> > <...
> >       if (E) {
> > -         ctl_fatal("%s", E);
> > +         C->error = E;
> > +         return;
> >       }  
> > ...>  
> >   }
> > 
> > Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>  
> 
> It's too bad that this generates code like this:
> 
>          char *error = ls_by_name_or_uuid(ctx, ctx->argv[1], false, &ls);
>          if (error) {
>             ctx->error = error;
>             return;
>          }
> 
> instead of the simpler:
> 
>          ctx->error = ls_by_name_or_uuid(ctx, ctx->argv[1], false, &ls);
>          if (ctx->error) {
>             return;
>          }
> 
> Oh well.

Let me see if I can come up with a semantic patch that corrects that.

-Jakub


More information about the dev mailing list