提交 265d0bed 编写于 作者: M Martin Kletzander

conf: Clean up and report error in virDomainGenerateMachineName

Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 2a544e31
......@@ -27481,25 +27481,23 @@ virDomainGenerateMachineName(const char *drivername,
const char *name,
bool privileged)
{
char *machinename = NULL;
char *username = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
if (privileged) {
virBufferAsprintf(&buf, "%s-", drivername);
} else {
if (!(username = virGetUserName(geteuid())))
goto cleanup;
if (!(username = virGetUserName(geteuid()))) {
virBufferFreeAndReset(&buf);
return NULL;
}
virBufferAsprintf(&buf, "%s-%s-", username, drivername);
VIR_FREE(username);
}
virBufferAsprintf(&buf, "%d-", id);
virDomainMachineNameAppendValid(&buf, name);
machinename = virBufferContentAndReset(&buf);
cleanup:
VIR_FREE(username);
return machinename;
virBufferCheckError(&buf);
return virBufferContentAndReset(&buf);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册