}
}
ret = qmp_chardev_add(bid ? bid : id, backend, errp);
- if (error_is_set(errp)) {
+ if (!ret) {
goto qapi_out;
}
backend->kind = CHARDEV_BACKEND_KIND_MUX;
backend->mux->chardev = g_strdup(bid);
ret = qmp_chardev_add(id, backend, errp);
- if (error_is_set(errp)) {
+ if (!ret) {
chr = qemu_chr_find(bid);
qemu_chr_delete(chr);
chr = NULL;
static CharDriverState *qmp_chardev_open_file(ChardevFile *file, Error **errp)
{
- int flags, in = -1, out = -1;
+ int flags, in = -1, out;
flags = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY;
out = qmp_chardev_open_file_source(file->out, flags, errp);
- if (error_is_set(errp)) {
+ if (out < 0) {
return NULL;
}
if (file->has_in) {
flags = O_RDONLY;
in = qmp_chardev_open_file_source(file->in, flags, errp);
- if (error_is_set(errp)) {
+ if (in < 0) {
qemu_close(out);
return NULL;
}
int fd;
fd = qmp_chardev_open_file_source(serial->device, O_RDWR, errp);
- if (error_is_set(errp)) {
+ if (fd < 0) {
return NULL;
}
qemu_set_nonblock(fd);
int fd;
fd = qmp_chardev_open_file_source(parallel->device, O_RDWR, errp);
- if (error_is_set(errp)) {
+ if (fd < 0) {
return NULL;
}
return qemu_chr_open_pp_fd(fd);
} else {
fd = socket_connect(addr, errp, NULL, NULL);
}
- if (error_is_set(errp)) {
+ if (fd < 0) {
return NULL;
}
return qemu_chr_open_socket_fd(fd, do_nodelay, is_listen,
int fd;
fd = socket_dgram(udp->remote, udp->local, errp);
- if (error_is_set(errp)) {
+ if (fd < 0) {
return NULL;
}
return qemu_chr_open_udp_fd(fd);