qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: qemu-devel@nongnu.orgqemu-devel@nongnu.org
Cc: Michael Tokarev <mjt@tls.msk.ru>
Subject: [Qemu-devel] [PATCH 2/3] use new path_has_protocol() in bdrv_find_protocol()
Date: Wed, 12 Jan 2011 13:57:01 +0300	[thread overview]
Message-ID: <1294829822-27938-3-git-send-email-mjt@msgid.tls.msk.ru> (raw)
In-Reply-To: <1294829822-27938-1-git-send-email-mjt@tls.msk.ru>

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 block.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/block.c b/block.c
index e5a6f60..42d6ff1 100644
--- a/block.c
+++ b/block.c
@@ -314,7 +314,7 @@ static BlockDriver *find_hdev_driver(const char *filename)
 BlockDriver *bdrv_find_protocol(const char *filename)
 {
     BlockDriver *drv1;
-    char protocol[128];
+    char protocol[MAX_PROTO_LEN+1];
     int len;
     const char *p;
 
@@ -332,14 +332,11 @@ BlockDriver *bdrv_find_protocol(const char *filename)
         return drv1;
     }
 
-    if (!path_has_protocol(filename)) {
+    p = path_has_protocol(filename);
+    if (!p) {
         return bdrv_find_format("file");
     }
-    p = strchr(filename, ':');
-    assert(p != NULL);
     len = p - filename;
-    if (len > sizeof(protocol) - 1)
-        len = sizeof(protocol) - 1;
     memcpy(protocol, filename, len);
     protocol[len] = '\0';
     QLIST_FOREACH(drv1, &bdrv_drivers, list) {
-- 
1.7.2.3

  parent reply	other threads:[~2011-01-12 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1294829822-27938-1-git-send-email-mjt@tls.msk.ru>
2011-01-12 10:57 ` [Qemu-devel] [PATCH 1/3] make path_has_protocol() to return pointer instead of bool Michael Tokarev
2011-01-21  9:29   ` Kevin Wolf
2011-01-12 10:57 ` Michael Tokarev [this message]
2011-01-12 10:57 ` [Qemu-devel] [PATCH 3/3] make path_combine() especially for filenames, not URLs Michael Tokarev
2011-01-21 10:07   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294829822-27938-3-git-send-email-mjt@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.orgqemu-devel \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).