qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vhost-user-test: fix crash with glib < 2.36


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH] vhost-user-test: fix crash with glib < 2.36
Date: Mon, 30 Nov 2015 12:06:42 +0100

Hi

On Mon, Nov 30, 2015 at 12:01 PM, Michael S. Tsirkin <address@hidden> wrote:
> glib manual says this about the prepare callback:
>     Since 2.36 this may be NULL, in which case the effect is as if the
>     function always returns FALSE with a timeout of -1.
>
> Fix code to work for older glib - simply implement
> a stub prepare callback.

That's what I did in my patch. However, I explained why I'd prefer to
keep the #ifdef to avoid the stub/dumb callback in the future.

>
> While we are at it, switch to named initializers for
> readability.
>

That's readability, not strictly required to fix the issue.

> Reported-by: Marc-André Lureau <address@hidden>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>  tests/vhost-user-test.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> index 29205ed..b67ca56 100644
> --- a/tests/vhost-user-test.c
> +++ b/tests/vhost-user-test.c
> @@ -506,11 +506,16 @@ test_migrate_source_check(GSource *source)
>      return FALSE;
>  }
>
> +static gboolean
> +test_migrate_source_prepare(GSource *source, gint *timeout)
> +{
> +    *timeout = -1;
> +    return FALSE;
> +}
> +
>  GSourceFuncs test_migrate_source_funcs = {
> -    NULL,
> -    test_migrate_source_check,
> -    NULL,
> -    NULL
> +    .prepare = test_migrate_source_prepare,
> +    .check = test_migrate_source_check,
>  };
>
>  static void test_migrate(void)
> --
> MST
>



-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]