return ret;
}
-int qemu_file_get_fd(QEMUFile *f)
+int qemu_file_get_fd(QEMUFile *f, int *fd)
{
- int fd = -1;
FdEntry *fde;
Error *err = NULL;
int service_byte;
goto fail;
}
- fd = fde->fd;
+ *fd = fde->fd;
QTAILQ_REMOVE(&f->fds, fde, entry);
g_free(fde);
- trace_qemu_file_get_fd(f->ioc->name, fd);
- return fd;
+ trace_qemu_file_get_fd(f->ioc->name, *fd);
+ return 0;
fail:
error_report_err(error_copy(err));
QIOChannel *qemu_file_get_ioc(QEMUFile *file);
int qemu_file_put_fd(QEMUFile *f, int fd);
-int qemu_file_get_fd(QEMUFile *f);
+int qemu_file_get_fd(QEMUFile *f, int *fd);
#endif
static int get_fd(QEMUFile *f, void *pv, size_t size,
const VMStateField *field)
{
- int fd;
int32_t *v = pv;
if (migrate_mode() == MIG_MODE_CPR_EXEC) {
return 0;
}
- fd = qemu_file_get_fd(f);
- if (fd < 0) {
- return -1;
- }
-
- *v = fd;
-
- return 0;
+ return qemu_file_get_fd(f, v);
}
static int put_fd(QEMUFile *f, void *pv, size_t size,