Am 26.02.2021 um 23:21 hat Eric Blake geschrieben:
On 2/24/21 7:52 AM, Kevin Wolf wrote:
> This is a version of user_creatable_process_cmdline() with an Error
> parameter that never calls exit() and is therefore usable in HMP.
>
> Signed-off-by: Kevin Wolf <kwolf(a)redhat.com>
> ---
> include/qom/object_interfaces.h | 16 ++++++++++++++++
> qom/object_interfaces.c | 29 ++++++++++++++++++++++++-----
> 2 files changed, 40 insertions(+), 5 deletions(-)
>
> +/**
> + * user_creatable_add_from_str:
> + * @optarg: the object definition string as passed on the command line
> + * @errp: if an error occurs, a pointer to an area to store the error
> + *
> + * Create an instance of the user creatable object by parsing optarg
> + * with a keyval parser and implicit key 'qom-type', converting the
> + * result to ObjectOptions and calling into qmp_object_add().
> + *
> + * If a help option is given, print help instead.
> + *
> + * Returns: true when an object was successfully created, false when an error
> + * occurred (*errp is set then) or help was printed (*errp is not set).
> + */
> +bool user_creatable_add_from_str(const char *optarg, Error **errp);
This could be used to fix the exit status 2 issue in qemu-img convert,
if you rearrange the series a bit.
Thanks for the suggestion, with this reordering the fix became quite
simple.
Kevin