From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCKW-0004W9-GZ for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKCKV-0004Uc-HV for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:56 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:54585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCKV-0004UQ-BU for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:55 -0400 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Oct 2012 12:08:54 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 3E75119D8043 for ; Fri, 5 Oct 2012 12:08:50 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q95I8PUq144122 for ; Fri, 5 Oct 2012 12:08:25 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q95I8NTZ009006 for ; Fri, 5 Oct 2012 12:08:24 -0600 From: Corey Bryant Date: Fri, 5 Oct 2012 14:07:02 -0400 Message-Id: <1349460425-30601-2-git-send-email-coreyb@linux.vnet.ibm.com> In-Reply-To: <1349460425-30601-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1349460425-30601-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 1/4] monitor: Less restrictive fd matching for fd sets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: libvir-list@redhat.com, kwolf@redhat.com, Corey Bryant , eblake@redhat.com 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 --- 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