On Mon, Sep 26, 2022 at 05:05:56PM -0500, Eric Blake wrote:
[...]
> @@ -102,6 +99,16 @@ main (int argc, char *argv[])
>      exit (EXIT_FAILURE);
>    }
> 
> +  /* info on something not present fails */
> +  if (nbd_set_export_name (nbd, "a") == -1) {
> +    fprintf (stderr, "%s\n", nbd_get_error ());
> +    exit (EXIT_FAILURE);
> +  }
> +  if (nbd_opt_info (nbd) != -1) {
> +    fprintf (stderr, "expecting error for opt_info\n");
> +    exit (EXIT_FAILURE);
> +  }

While looking at this, I found this which seems like it may be wrong
(lib/opt.c):

  /* Issue NBD_OPT_INFO and wait for the reply. */
  int
  nbd_unlocked_opt_info (struct nbd_handle *h)
  ...
    r = wait_for_option (h);
    if (r == 0 && err) {
      assert (nbd_internal_is_state_negotiating (get_next_state (h)) ||
              nbd_internal_is_state_dead (get_next_state (h)));
      set_error (err, "server replied with error to opt_info request");

I believe that r == 0 && err != 0 => the callback set *err; in which
case the error message is wrong?

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
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to