Received: from eggs.gnu.org ([2001:4830:134:3::10]:54908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3MDX-0006Ki-25 for qemu-devel@nongnu.org; Mon, 30 Nov 2015 06:02:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3MDT-0003FE-1i for qemu-devel@nongnu.org; Mon, 30 Nov 2015 06:01:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3MDS-0003FA-TQ for qemu-devel@nongnu.org; Mon, 30 Nov 2015 06:01:54 -0500 Date: Mon, 30 Nov 2015 13:01:51 +0200 From: "Michael S. Tsirkin" Message-ID: <1448881300-18473-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] vhost-user-test: fix crash with glib < 2.36 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?us-ascii?B?PT9VVEYtOD9xP01hcmMtQW5kcj1DMz1BOT0yMEx1cmVhdT89?= , Yuanhan Liu , Paolo Bonzini 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. While we are at it, switch to named initializers for readability. Reported-by: Marc-Andr=E9 Lureau Signed-off-by: Michael S. Tsirkin --- 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; } =20 +static gboolean +test_migrate_source_prepare(GSource *source, gint *timeout) +{ + *timeout =3D -1; + return FALSE; +} + GSourceFuncs test_migrate_source_funcs =3D { - NULL, - test_migrate_source_check, - NULL, - NULL + .prepare =3D test_migrate_source_prepare, + .check =3D test_migrate_source_check, }; =20 static void test_migrate(void) --=20 MST