Skip to content

Commit

Permalink
io: Add /dev/fdset/ support to QIOChannelFile
Browse files Browse the repository at this point in the history
Add /dev/fdset/ support to QIOChannelFile by calling qemu_open() instead
of open() and qemu_close() instead of close(). There is a subtle
semantic change since qemu_open() automatically sets O_CLOEXEC, but this
doesn't affect any of the users of the function.

Signed-off-by: Ross Lagerwall <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
  • Loading branch information
rosslagerwall authored and berrange committed Feb 15, 2018
1 parent a2565df commit b8f244b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions io/channel-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ qio_channel_file_new_path(const char *path,

ioc = QIO_CHANNEL_FILE(object_new(TYPE_QIO_CHANNEL_FILE));

ioc->fd = open(path, flags, mode);
ioc->fd = qemu_open(path, flags, mode);
if (ioc->fd < 0) {
object_unref(OBJECT(ioc));
error_setg_errno(errp, errno,
Expand All @@ -74,7 +74,7 @@ static void qio_channel_file_finalize(Object *obj)
{
QIOChannelFile *ioc = QIO_CHANNEL_FILE(obj);
if (ioc->fd != -1) {
close(ioc->fd);
qemu_close(ioc->fd);
ioc->fd = -1;
}
}
Expand Down Expand Up @@ -173,7 +173,7 @@ static int qio_channel_file_close(QIOChannel *ioc,
{
QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);

if (close(fioc->fd) < 0) {
if (qemu_close(fioc->fd) < 0) {
error_setg_errno(errp, errno,
"Unable to close file");
return -1;
Expand Down

0 comments on commit b8f244b

Please sign in to comment.