From: Jun Li <junmuzi@gmail.com>
To: qemu-devel@nongnu.org
Cc: Jun Li <junmuzi@gmail.com>
Subject: [Qemu-devel] [PATCH] Modify qemu-img can not create local filename contain ":"
Date: Mon, 3 Mar 2014 22:02:19 +0800 [thread overview]
Message-ID: <1393855339-13878-1-git-send-email-junmuzi@gmail.com> (raw)
Such as how to visit glusterfs:
file=gluster://1.2.3.4/testvol/a.img
file=gluster+tcp://1.2.3.4/testvol/a.img
file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
file=gluster+rdma://1.2.3.4:24007/testvol/a.img
----
So if only the path contain "://", the path maybe contain a protocol. So use
strstr() to replace func strcspn().
Signed-off-by: Jun Li <junmuzi@gmail.com>
---
block.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 2fd5482..aead10e 100644
--- a/block.c
+++ b/block.c
@@ -237,12 +237,12 @@ static int path_has_protocol(const char *path)
is_windows_drive_prefix(path)) {
return 0;
}
- p = path + strcspn(path, ":/\\");
+ p = strstr(path, ":/\\");
#else
- p = path + strcspn(path, ":/");
+ p = strstr(path, "://");
#endif
- return *p == ':';
+ return p != NULL;
}
int path_is_absolute(const char *path)
--
1.8.3.1
next reply other threads:[~2014-03-03 14:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-03 14:02 Jun Li [this message]
2014-03-03 17:47 ` [Qemu-devel] [PATCH] Modify qemu-img can not create local filename contain ":" Max Reitz
2014-03-03 18:03 ` Eric Blake
2014-03-03 18:06 ` Max Reitz
-- strict thread matches above, loose matches on Subject: below --
2014-03-05 15:33 jun muzi
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=1393855339-13878-1-git-send-email-junmuzi@gmail.com \
--to=junmuzi@gmail.com \
--cc=qemu-devel@nongnu.org \
/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).