aboutsummaryrefslogtreecommitdiff
path: root/io/channel-command.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-25 17:39:06 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-05-03 15:52:25 +0400
commit17fc124529abfda185e69fa1220e5f404be22d25 (patch)
tree96762ae195b993bccaae067e48eeaf9aa1982c4e /io/channel-command.c
parentb84bb4dfe5d03b40c91260db8ee07d65809fc35f (diff)
io: replace qemu_set{_non}block()
Those calls are non-socket fd, or are POSIX-specific. Use the dedicated GLib API. (qemu_set_nonblock() is for socket-like) (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>
Diffstat (limited to 'io/channel-command.c')
-rw-r--r--io/channel-command.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/io/channel-command.c b/io/channel-command.c
index 0790ac7895..4a1f969aaa 100644
--- a/io/channel-command.c
+++ b/io/channel-command.c
@@ -301,16 +301,18 @@ static int qio_channel_command_set_blocking(QIOChannel *ioc,
bool enabled,
Error **errp)
{
+#ifdef WIN32
+ /* command spawn is not supported on win32 */
+ g_assert_not_reached();
+#else
QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc);
- if (enabled) {
- qemu_set_block(cioc->writefd);
- qemu_set_block(cioc->readfd);
- } else {
- qemu_set_nonblock(cioc->writefd);
- qemu_set_nonblock(cioc->readfd);
+ if (!g_unix_set_fd_nonblocking(cioc->writefd, !enabled, NULL) ||
+ !g_unix_set_fd_nonblocking(cioc->readfd, !enabled, NULL)) {
+ error_setg_errno(errp, errno, "Failed to set FD nonblocking");
+ return -1;
}
-
+#endif
return 0;
}