From db015fa75ee1f475040dba0512fca094e3a54d9d Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 6 Aug 2012 11:20:10 +0200 Subject: [PATCH] Avoid using unix path as "database name" for virt_db Fix split_zurl to use cs_get_host_args which considers unix sockets as well. --- src/util.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 3ab3033..4d433a5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include #include #include #include @@ -406,14 +407,15 @@ void mp_util::split_zurl(std::string zurl, std::string &host, std::list &db) { const char *zurl_cstr = zurl.c_str(); - const char *sep = strchr(zurl_cstr, '/'); - - if (sep) - { - host = std::string(zurl_cstr, sep - zurl_cstr); + const char *args = 0; + cs_get_host_args(zurl_cstr, &args); + + if (args && *args) + { + host = std::string(zurl_cstr, args - zurl_cstr); - const char *cp1 = sep+1; - while(1) + const char *cp1 = args + 1; + while (1) { const char *cp2 = strchr(cp1, '+'); if (cp2) @@ -427,9 +429,7 @@ void mp_util::split_zurl(std::string zurl, std::string &host, } } else - { host = zurl; - } } bool mp_util::set_databases_from_zurl( -- 1.7.10.4