From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQxck-0002Ph-1a for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQxcd-0006rg-Uv for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2064) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQxcd-0006rI-NP for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:35 -0400 From: Kevin Wolf Date: Wed, 24 Oct 2012 11:50:56 +0200 Message-Id: <1351072256-6112-33-git-send-email-kwolf@redhat.com> In-Reply-To: <1351072256-6112-1-git-send-email-kwolf@redhat.com> References: <1351072256-6112-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 32/32] osdep: Less restrictive F_SEFL in qemu_dup_flags() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Corey Bryant qemu_dup_flags() currently limits the flags that can be set on the fcntl() F_SETFL call to those that we currently know can be set with fcntl() F_SETFL. The problem with this is that it will prevent use of new flags in the future without a code update. This patch relaxes the checking and lets fcntl() determine the flags it can set. Signed-off-by: Corey Bryant Signed-off-by: Kevin Wolf --- osdep.c | 12 +----------- 1 files changed, 1 insertions(+), 11 deletions(-) diff --git a/osdep.c b/osdep.c index 3b25297..c822a01 100644 --- a/osdep.c +++ b/osdep.c @@ -88,7 +88,6 @@ static int qemu_dup_flags(int fd, int flags) int ret; int serrno; int dup_flags; - int setfl_flags; #ifdef F_DUPFD_CLOEXEC ret = fcntl(fd, F_DUPFD_CLOEXEC, 0); @@ -113,16 +112,7 @@ static int qemu_dup_flags(int fd, int flags) } /* Set/unset flags that we can with fcntl */ - setfl_flags = O_APPEND | O_ASYNC | O_NONBLOCK; -#ifdef O_NOATIME - setfl_flags |= O_NOATIME; -#endif -#ifdef O_DIRECT - setfl_flags |= O_DIRECT; -#endif - dup_flags &= ~setfl_flags; - dup_flags |= (flags & setfl_flags); - if (fcntl(ret, F_SETFL, dup_flags) == -1) { + if (fcntl(ret, F_SETFL, flags) == -1) { goto fail; } -- 1.7.6.5