tests: replace qemu_set_nonblock()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 25 Apr 2022 13:39:06 +0000 (17:39 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 3 May 2022 11:53:15 +0000 (15:53 +0400)
The call is POSIX-specific. Use the dedicated GLib API.

(this is a preliminary patch before renaming qemu_set_nonblock())

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
tests/qtest/vhost-user-test.c

index ee30f54796485e1fb2cab1fe76416ca163a51631..a2cec87684625c49c062857600bb73eea677c71e 100644 (file)
@@ -302,6 +302,7 @@ static int chr_can_read(void *opaque)
 
 static void chr_read(void *opaque, const uint8_t *buf, int size)
 {
+    g_autoptr(GError) err = NULL;
     TestServer *s = opaque;
     CharBackend *chr = &s->chr;
     VhostUserMsg msg;
@@ -394,7 +395,8 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
          * The receive function forces it to be blocking,
          * so revert it back to non-blocking.
          */
-        qemu_set_nonblock(fd);
+        g_unix_set_fd_nonblocking(fd, true, &err);
+        g_assert_no_error(err);
         break;
 
     case VHOST_USER_SET_LOG_BASE: