
/** * virAdmConnectOpen: * @name: uri of the daemon to connect to, NULL for default @@ -170,6 +199,7 @@ virAdmConnectOpen(const char *name, unsigned int flags) { char *sock_path = NULL; virAdmConnectPtr conn = NULL; + virConfPtr conf = NULL;
if (virAdmInitialize() < 0) goto error; @@ -180,7 +210,18 @@ virAdmConnectOpen(const char *name, unsigned int flags) if (!(conn = virAdmConnectNew())) goto error;
- if (!(sock_path = getSocketPath(name))) + if (virGetLibvirtConfigFile(&conf) < 0) + goto error; + + if (!name) { + if (virAdmGetDefaultURI(conf, &conn->uri) < 0)
Are we planning on using the @conf anywhere else? If not, I'd put the config getting inside this function.
Actually, yes. A couple of days ago I realized that I forgot to introduce URI aliases support in this series, so I prepared a patch for that on my local branch, where I'm reusing the @conf reference as I need to read uri_aliases variable from the config.