提交 615106fb 编写于 作者: M Martin Kletzander

qemu: Fix virDoes*Exist usage

The virGet*ID() functions should be called only if the user exists not when it
doesn't.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 41ce8815
...@@ -193,10 +193,10 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) ...@@ -193,10 +193,10 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
if (virAsprintf(&cfg->swtpmStorageDir, "%s/lib/libvirt/swtpm", if (virAsprintf(&cfg->swtpmStorageDir, "%s/lib/libvirt/swtpm",
LOCALSTATEDIR) < 0) LOCALSTATEDIR) < 0)
goto error; goto error;
if (virDoesUserExist("tss") != 0 || if (!virDoesUserExist("tss") ||
virGetUserID("tss", &cfg->swtpm_user) < 0) virGetUserID("tss", &cfg->swtpm_user) < 0)
cfg->swtpm_user = 0; /* fall back to root */ cfg->swtpm_user = 0; /* fall back to root */
if (virDoesGroupExist("tss") != 0 || if (!virDoesGroupExist("tss") ||
virGetGroupID("tss", &cfg->swtpm_group) < 0) virGetGroupID("tss", &cfg->swtpm_group) < 0)
cfg->swtpm_group = 0; /* fall back to root */ cfg->swtpm_group = 0; /* fall back to root */
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册