From patchwork Thu Jun 14 15:55:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v3, 5/5] block: Prevent /dev/fd/X filename from being detected as floppy Date: Thu, 14 Jun 2012 05:55:05 -0000 From: Corey Bryant X-Patchwork-Id: 164958 Message-Id: <1339689305-27031-6-git-send-email-coreyb@linux.vnet.ibm.com> To: qemu-devel@nongnu.org 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 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) {