StringList parameters (char ** in C) will be marked with __attribute__((nonnull)). To pass an empty list you have to use a list containing a single NULL element, not a NULL pointer.
nbd_internal_set_querylist has also been adjusted. Fixes: commit e33762a86cd5f064e5ef841520baa5fe7361d2c2 --- generator/states-newstyle-opt-meta-context.c | 4 +++- lib/opt.c | 16 ++++++++++++---- lib/utils.c | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/generator/states-newstyle-opt-meta-context.c b/generator/states-newstyle-opt-meta-context.c index 46fee15be1..a60aa66f3b 100644 --- a/generator/states-newstyle-opt-meta-context.c +++ b/generator/states-newstyle-opt-meta-context.c @@ -65,12 +65,14 @@ NEWSTYLE.OPT_META_CONTEXT.START: } } if (opt != h->opt_current) { + char *empty[] = { NULL }; + if (!h->request_meta || !h->structured_replies || h->request_meta_contexts.len == 0) { SET_NEXT_STATE (%^OPT_GO.START); return 0; } - if (nbd_internal_set_querylist (h, NULL) == -1) { + if (nbd_internal_set_querylist (h, empty) == -1) { SET_NEXT_STATE (%.DEAD); return 0; } diff --git a/lib/opt.c b/lib/opt.c index 1b18920fdb..e323d7b1b0 100644 --- a/lib/opt.c +++ b/lib/opt.c @@ -224,7 +224,9 @@ int nbd_unlocked_opt_list_meta_context (struct nbd_handle *h, nbd_context_callback *context) { - return nbd_unlocked_opt_list_meta_context_queries (h, NULL, context); + char *empty[] = { NULL }; + + return nbd_unlocked_opt_list_meta_context_queries (h, empty, context); } /* Issue NBD_OPT_LIST_META_CONTEXT and wait for the reply. */ @@ -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); + char *empty[] = { NULL }; + + return nbd_unlocked_opt_set_meta_context_queries (h, empty, context); } /* Issue NBD_OPT_SET_META_CONTEXT and wait for the reply. */ @@ -371,7 +375,9 @@ nbd_unlocked_aio_opt_list_meta_context (struct nbd_handle *h, nbd_context_callback *context, nbd_completion_callback *complete) { - return nbd_unlocked_aio_opt_list_meta_context_queries (h, NULL, context, + char *empty[] = { NULL }; + + return nbd_unlocked_aio_opt_list_meta_context_queries (h, empty, context, complete); } @@ -407,7 +413,9 @@ nbd_unlocked_aio_opt_set_meta_context (struct nbd_handle *h, nbd_context_callback *context, nbd_completion_callback *complete) { - return nbd_unlocked_aio_opt_set_meta_context_queries (h, NULL, context, + char *empty[] = { NULL }; + + return nbd_unlocked_aio_opt_set_meta_context_queries (h, empty, context, complete); } diff --git a/lib/utils.c b/lib/utils.c index c1d633fea1..b4043aa3bc 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -100,7 +100,7 @@ nbd_internal_set_querylist (struct nbd_handle *h, char **queries) { size_t i; - if (queries) { + if (queries[0] != NULL /* non-empty list */) { if (nbd_internal_copy_string_list (&h->querylist, queries) == -1) { set_error (errno, "realloc"); return -1; @@ -109,7 +109,7 @@ nbd_internal_set_querylist (struct nbd_handle *h, char **queries) assert (h->querylist.len > 0); string_vector_remove (&h->querylist, h->querylist.len - 1); } - else { + else /* empty list */ { string_vector_reset (&h->querylist); for (i = 0; i < h->request_meta_contexts.len; ++i) { char *copy = strdup (h->request_meta_contexts.ptr[i]); -- 2.37.0.rc2 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs