io: Stop using qemu_open_old in channel-file
We want to make use of the Error object to report fdset errors from qemu_open_internal() and passing the error pointer to qemu_open_old() would require changing all callers. Move the file channel to the new API instead. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
960f29b347
commit
46cec74c1b
@ -68,11 +68,13 @@ qio_channel_file_new_path(const char *path,
|
|||||||
|
|
||||||
ioc = QIO_CHANNEL_FILE(object_new(TYPE_QIO_CHANNEL_FILE));
|
ioc = QIO_CHANNEL_FILE(object_new(TYPE_QIO_CHANNEL_FILE));
|
||||||
|
|
||||||
ioc->fd = qemu_open_old(path, flags, mode);
|
if (flags & O_CREAT) {
|
||||||
|
ioc->fd = qemu_create(path, flags & ~O_CREAT, mode, errp);
|
||||||
|
} else {
|
||||||
|
ioc->fd = qemu_open(path, flags, errp);
|
||||||
|
}
|
||||||
if (ioc->fd < 0) {
|
if (ioc->fd < 0) {
|
||||||
object_unref(OBJECT(ioc));
|
object_unref(OBJECT(ioc));
|
||||||
error_setg_errno(errp, errno,
|
|
||||||
"Unable to open %s", path);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user