From patchwork Thu Jun 14 15:55:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Bryant X-Patchwork-Id: 164958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B30B8B7000 for ; Fri, 15 Jun 2012 01:55:40 +1000 (EST) Received: from localhost ([::1]:47753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfCOY-00051j-LU for incoming@patchwork.ozlabs.org; Thu, 14 Jun 2012 11:55:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfCOL-0004pI-3A for qemu-devel@nongnu.org; Thu, 14 Jun 2012 11:55:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfCOC-0003xf-Gt for qemu-devel@nongnu.org; Thu, 14 Jun 2012 11:55:24 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:57724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfCOC-0003wg-Ai for qemu-devel@nongnu.org; Thu, 14 Jun 2012 11:55:16 -0400 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Jun 2012 09:55:10 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 14 Jun 2012 09:54:22 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 811BC1FF0020 for ; Thu, 14 Jun 2012 15:54:20 +0000 (WET) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5EFsBNR112770 for ; Thu, 14 Jun 2012 09:54:11 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5EFsA1g004444 for ; Thu, 14 Jun 2012 09:54:10 -0600 Received: from localhost ([9.80.103.203]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q5EFs92q004365; Thu, 14 Jun 2012 09:54:10 -0600 From: Corey Bryant To: qemu-devel@nongnu.org Date: Thu, 14 Jun 2012 11:55:05 -0400 Message-Id: <1339689305-27031-6-git-send-email-coreyb@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.2 In-Reply-To: <1339689305-27031-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1339689305-27031-1-git-send-email-coreyb@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12061415-6148-0000-0000-000006B2E7DA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.153 Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, libvir-list@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, eblake@redhat.com Subject: [Qemu-devel] [PATCH v3 5/5] block: Prevent /dev/fd/X filename from being detected as floppy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Reported-by: Kevin Wolf Reviewed-by: Paolo Bonzini Signed-off-by: Corey Bryant --- v3: -This patch is new in v3. It was previously submitted on its own, and is now being included in this series. block/raw-posix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index d8eff2f..68886cd 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -946,9 +946,11 @@ static int floppy_probe_device(const char *filename) int prio = 0; struct floppy_struct fdparam; struct stat st; + const char *p; - if (strstart(filename, "/dev/fd", NULL)) + if (strstart(filename, "/dev/fd", &p) && p[0] != '/') { prio = 50; + } fd = qemu_open(filename, O_RDONLY | O_NONBLOCK); if (fd < 0) {