提交 1af9800b 编写于 作者: M Michael Chapman 提交者: Michal Privoznik

virIdentityGetSystem: don't fail if SELinux is disabled

If SELinux is compiled into libvirt but it is disabled on the host,
libvirtd logs:

  error : virIdentityGetSystem:173 : Unable to lookup SELinux process
  context: Invalid argument

on each and every client connection.

Use is_selinux_enabled() to skip retrieval of the process's SELinux
context if SELinux is disabled.
Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
上级 5eb5fb80
......@@ -168,16 +168,18 @@ virIdentityPtr virIdentityGetSystem(void)
goto cleanup;
#if WITH_SELINUX
if (getcon(&con) < 0) {
virReportSystemError(errno, "%s",
_("Unable to lookup SELinux process context"));
goto cleanup;
}
if (VIR_STRDUP(seccontext, con) < 0) {
if (is_selinux_enabled()) {
if (getcon(&con) < 0) {
virReportSystemError(errno, "%s",
_("Unable to lookup SELinux process context"));
goto cleanup;
}
if (VIR_STRDUP(seccontext, con) < 0) {
freecon(con);
goto cleanup;
}
freecon(con);
goto cleanup;
}
freecon(con);
#endif
if (!(ret = virIdentityNew()))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册