[Libguestfs] [PATCH libnbd v3 1/6] lib/opt: Don't use NULL for an empty StringList

Richard W.M. Jones rjones at redhat.com
Thu Sep 29 07:55:44 UTC 2022


OK now I remember what the problem was.

> @@ -255,7 +257,9 @@ int
>  nbd_unlocked_opt_set_meta_context (struct nbd_handle *h,
>                                     nbd_context_callback *context)
>  {
> -  return nbd_unlocked_opt_set_meta_context_queries (h, NULL, context);

In this original code you're calling the internal unlocked version of
nbd_opt_set_meta_context_queries.  However the generator is creating a
prototype for the unlocked function and it adds the
attribute((nonnull)) annotation for it, something like:

  extern int nbd_unlocked_opt_set_meta_context_queries (...)
    LIBNBD_ATTRIBUTE_NONNULL((1, 2));

This means that you cannot use queries == NULL here.

I think the generated annotation is correct, but we need a new
unannotated internal function that allows queries == NULL.

I'll try to come up with something.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW


More information about the Libguestfs mailing list