mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Improve error reporting for virConnectGetHostname calls
All drivers have copy + pasted inadequate error reporting which wraps util.c:virGetHostname. Move all error reporting to this function, and improve what we report. Changes from v1: Drop the driver wrappers around virGetHostname. This means we still need to keep the new conn argument to virGetHostname, but I think it's worth it.
This commit is contained in:
@@ -972,11 +972,10 @@ static int qemudNetworkInit(struct qemud_server *server) {
|
||||
if (!mdns_name) {
|
||||
char groupname[64], *localhost, *tmp;
|
||||
/* Extract the host part of the potentially FQDN */
|
||||
localhost = virGetHostname();
|
||||
if (localhost == NULL) {
|
||||
virReportOOMError(NULL);
|
||||
localhost = virGetHostname(NULL);
|
||||
if (localhost == NULL)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((tmp = strchr(localhost, '.')))
|
||||
*tmp = '\0';
|
||||
snprintf(groupname, sizeof(groupname)-1, "Virtualization Host %s", localhost);
|
||||
|
||||
Reference in New Issue
Block a user