diff options
Diffstat (limited to 'chardev/char-serial.c')
-rw-r--r-- | chardev/char-serial.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chardev/char-serial.c b/chardev/char-serial.c index 0a68b4b..4c6ca71 100644 --- a/chardev/char-serial.c +++ b/chardev/char-serial.c @@ -271,13 +271,16 @@ static void qmp_chardev_open_serial(Chardev *chr, if (fd < 0) { return; } - if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { - error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + if (!qemu_set_blocking(fd, false, errp)) { + close(fd); return; } tty_serial_init(fd, 115200, 'N', 8, 1); - qemu_chr_open_fd(chr, fd, fd); + if (!qemu_chr_open_fd(chr, fd, fd, errp)) { + close(fd); + return; + } } #endif /* __linux__ || __sun__ */ |