[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1] async: aio_context_new(): Handle event_notif
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v1] async: aio_context_new(): Handle event_notifier_init failure |
Date: |
Tue, 16 Sep 2014 15:43:13 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Sun, Sep 14, 2014 at 01:23:13PM +0300, Chrysostomos Nanakos wrote:
> @@ -63,10 +64,19 @@ static void iothread_instance_finalize(Object *obj)
>
> static void iothread_complete(UserCreatable *obj, Error **errp)
> {
> + int ret;
> + Error *local_error = NULL;
> IOThread *iothread = IOTHREAD(obj);
>
> iothread->stopping = false;
> - iothread->ctx = aio_context_new();
> + ret = aio_context_new(&iothread->ctx, &local_error);
> + if (ret < 0) {
> + errno = -ret;
> + error_report("%s", error_get_pretty(local_error));
> + error_report("iothread_complete failed");
> + error_free(local_error);
> + exit(1);
> + }
Why use error_report()? The function takes an errp argument so
local_error should be propagated.
> @@ -2893,7 +2895,14 @@ int main(int argc, char **argv)
> error_set_progname(argv[0]);
> qemu_init_exec_dir(argv[0]);
>
> - qemu_init_main_loop();
> + ret = qemu_init_main_loop(&local_error);
> + if (ret < 0) {
> + errno = -ret;
> + error_report("%s", error_get_pretty(local_error));
> + error_free(local_error);
> + error_exit("qemu_init_main_loop failed");
> + }
IMO it's okay to leak local_error here:
error_exit("%s", error_get_pretty(local_error));
qemu_init_main_loop failed is not a meaningful error message, please
drop it and keep just the detailed message.
pgpK6r8lXsTkQ.pgp
Description: PGP signature