On Wed, Sep 28, 2022 at 05:08:40PM -0500, Eric Blake wrote:
On Wed, Sep 28, 2022 at 06:25:36PM +0100, Richard W.M. Jones wrote:
> ---
> lib/internal.h | 75 +++++++++++++++++++++++++++++++++-----------------
> 1 file changed, 50 insertions(+), 25 deletions(-)
>
> /* utils.c */
> -extern void nbd_internal_hexdump (const void *data, size_t len, FILE *fp);
> -extern int nbd_internal_copy_string_list (string_vector *v, char **in);
> -extern int nbd_internal_set_argv (struct nbd_handle *h, char **argv);
> -extern int nbd_internal_set_querylist (struct nbd_handle *h, char **queries);
> -extern const char *nbd_internal_fork_safe_itoa (long v, char *buf, size_t len);
> -extern void nbd_internal_fork_safe_perror (const char *s);
> -extern char *nbd_internal_printable_buffer (const void *buf, size_t count);
> -extern char *nbd_internal_printable_string (const char *str);
> +extern void nbd_internal_hexdump (const void *data, size_t len, FILE *fp)
> + LIBNBD_ATTRIBUTE_NONNULL((1, 3));
> +extern int nbd_internal_copy_string_list (string_vector *v, char **in)
> + LIBNBD_ATTRIBUTE_NONNULL((1, 2));
> +extern int nbd_internal_set_argv (struct nbd_handle *h, char **argv)
> + LIBNBD_ATTRIBUTE_NONNULL((1, 2));
> +extern int nbd_internal_set_querylist (struct nbd_handle *h, char **queries)
> + LIBNBD_ATTRIBUTE_NONNULL((1, 2));
The ', 2' is wrong here, based on my review of 1/6. This is one
helper where I wanted NULL to mean "copy the implicit
h->request_meta_contexts", and non-NULL to be "copy this explicit
list, even if it is empty".
FYI I fixed this (removed the ",2") in my updated patch. The function
allows queries == NULL as a valid input as before.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org