]> git.proxmox.com Git - mirror_qemu.git/commit
error: Fix use of error_prepend() with &error_fatal, &error_abort
authorMarkus Armbruster <armbru@redhat.com>
Wed, 17 Oct 2018 08:26:25 +0000 (10:26 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 19 Oct 2018 12:51:34 +0000 (14:51 +0200)
commit4b5766488fd3549dc47a75331cf4db62f477536c
treeded71544d77610628957f5be840439cbf0b26455
parentd7ecf712382486ef0d79fe335f5abb333b44d279
error: Fix use of error_prepend() with &error_fatal, &error_abort

From include/qapi/error.h:

  * Pass an existing error to the caller with the message modified:
  *     error_propagate(errp, err);
  *     error_prepend(errp, "Could not frobnicate '%s': ", name);

Fei Li pointed out that doing error_propagate() first doesn't work
well when @errp is &error_fatal or &error_abort: the error_prepend()
is never reached.

Since I doubt fixing the documentation will stop people from getting
it wrong, introduce error_propagate_prepend(), in the hope that it
lures people away from using its constituents in the wrong order.
Update the instructions in error.h accordingly.

Convert existing error_prepend() next to error_propagate to
error_propagate_prepend().  If any of these get reached with
&error_fatal or &error_abort, the error messages improve.  I didn't
check whether that's the case anywhere.

Cc: Fei Li <fli@suse.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181017082702.5581-2-armbru@redhat.com>
13 files changed:
block.c
block/qcow2.c
block/qed.c
hw/9pfs/9p-local.c
hw/intc/xics.c
hw/ppc/pnv_core.c
hw/ppc/spapr_pci.c
hw/timer/aspeed_timer.c
hw/usb/bus.c
hw/vfio/pci.c
include/qapi/error.h
migration/migration.c
util/error.c