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

Ben Pfaff blp at ovn.org
Mon Jul 23 22:36:28 UTC 2018


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.


More information about the dev mailing list