diff --git a/src/util/viruri.c b/src/util/viruri.c index 35efad86f71c25926a5e0fa3a0ccaeddcd6af991..eee0b19e0c8c5acc41f7e1e5e469d705667ac155 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -258,6 +258,13 @@ virURIFormat(virURIPtr uri) xmluri.server = tmpserver; } + /* + * This helps libxml2 deal with the difference + * between uri:/absolute/path and uri:///absolute/path. + */ + if (!xmluri.server && !xmluri.port) + xmluri.port = -1; + ret = (char *)xmlSaveUri(&xmluri); if (!ret) { virReportOOMError();