aboutsummaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@suse.de>2024-06-17 15:57:25 -0300
committerFabiano Rosas <farosas@suse.de>2024-06-21 09:47:22 -0300
commit46cec74c1b71973756d8960a305bae1491ae6259 (patch)
tree213820d238664d23e74053542271f5754110888c /io
parent960f29b347ad34a53580fa822083d51ba7851b7b (diff)
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>
Diffstat (limited to 'io')
-rw-r--r--io/channel-file.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/io/channel-file.c b/io/channel-file.c
index 6436cfb6ae..2ea8d08360 100644
--- a/io/channel-file.c
+++ b/io/channel-file.c
@@ -68,11 +68,13 @@ qio_channel_file_new_path(const char *path,
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) {
object_unref(OBJECT(ioc));
- error_setg_errno(errp, errno,
- "Unable to open %s", path);
return NULL;
}