mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
virDomainGenerateMachineName: Use g_autofree for @username
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
06a19921b6
commit
1dd3282873
@ -31080,18 +31080,17 @@ virDomainGenerateMachineName(const char *drivername,
|
||||
const char *name,
|
||||
bool privileged)
|
||||
{
|
||||
char *username = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (privileged) {
|
||||
virBufferAsprintf(&buf, "%s-", drivername);
|
||||
} else {
|
||||
g_autofree char *username = NULL;
|
||||
if (!(username = virGetUserName(geteuid()))) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
return NULL;
|
||||
}
|
||||
virBufferAsprintf(&buf, "%s-%s-", username, drivername);
|
||||
VIR_FREE(username);
|
||||
}
|
||||
|
||||
virBufferAsprintf(&buf, "%d-", id);
|
||||
|
Loading…
Reference in New Issue
Block a user