]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Report less errors on driver startup
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 12 Sep 2018 14:32:56 +0000 (16:32 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Thu, 13 Sep 2018 14:19:25 +0000 (16:19 +0200)
It is not a problem at all if the `tss` user/group does not exist, the code
fallbacks to the `root` user/group.  However we report a warning for no reason
on every start-up.  Fix this by checking if the user/group actually exists.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_conf.c

index a4f545ef9243645ac224b5cf58a0aeedda351e8a..4d69b599fed88877ac35fba2944f62fffd668528 100644 (file)
@@ -197,9 +197,11 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
         if (virAsprintf(&cfg->swtpmStorageDir, "%s/lib/libvirt/swtpm",
                         LOCALSTATEDIR) < 0)
             goto error;
-        if (virGetUserID("tss", &cfg->swtpm_user) < 0)
+        if (virDoesUserExist("tss") != 0 ||
+            virGetUserID("tss", &cfg->swtpm_user) < 0)
             cfg->swtpm_user = 0; /* fall back to root */
-        if (virGetGroupID("tss", &cfg->swtpm_group) < 0)
+        if (virDoesGroupExist("tss") != 0 ||
+            virGetGroupID("tss", &cfg->swtpm_group) < 0)
             cfg->swtpm_group = 0; /* fall back to root */
     } else {
         char *rundir;