[PATCH 1/4] monitor: Less restrictive fd matching for fd sets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, in order to use a file descriptor that resides in an
fd set, the access mode flag of the qemu_open() call has to be
an exact match of the access mode flag of an fd in the requested
fd set.

This patch lightens up that restriction.  For example, if QEMU
attempts to qemu_open() "/dev/fdset/2" with O_RDONLY or O_WRONLY,
and an fd in fd set 2 has O_RDWR, the call will now be successful.

Signed-off-by: Corey Bryant <coreyb@xxxxxxxxxxxxxxxxxx>
---
 monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/monitor.c b/monitor.c
index a0e3ffb..34a968c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2304,7 +2304,8 @@ int monitor_fdset_get_fd(int64_t fdset_id, int flags)
                 return -1;
             }
 
-            if ((flags & O_ACCMODE) == (mon_fd_flags & O_ACCMODE)) {
+            if ((mon_fd_flags & O_ACCMODE) == O_RDWR ||
+                (mon_fd_flags & O_ACCMODE) == (flags & O_ACCMODE)) {
                 return mon_fdset_fd->fd;
             }
         }
-- 
1.7.11.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]