qemu: virtiofs: error out if getting the group or user name fails

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2024-03-07 13:36:45 +01:00
parent 4c5b2e1e0d
commit c9de7a1c3b

View File

@ -388,6 +388,9 @@ qemuVirtioFSPrepareIdMap(virDomainFSDef *fs)
username = virGetUserName(euid); username = virGetUserName(euid);
groupname = virGetGroupName(egid); groupname = virGetGroupName(egid);
if (!username || !groupname)
return -1;
fs->idmap.uidmap = g_new0(virDomainIdMapEntry, 2); fs->idmap.uidmap = g_new0(virDomainIdMapEntry, 2);
fs->idmap.gidmap = g_new0(virDomainIdMapEntry, 2); fs->idmap.gidmap = g_new0(virDomainIdMapEntry, 2);