policycoreutils/policycoreutils-2.0.83-disable.patch

26 lines
1.1 KiB
Diff

diff -up policycoreutils-2.0.83/load_policy/load_policy.c.init policycoreutils-2.0.83/load_policy/load_policy.c
--- policycoreutils-2.0.83/load_policy/load_policy.c.init 2010-11-08 13:46:37.000000000 -0500
+++ policycoreutils-2.0.83/load_policy/load_policy.c 2010-11-22 13:43:58.000000000 -0500
@@ -74,6 +74,7 @@ int main(int argc, char **argv)
"%s: Warning! Boolean file argument (%s) is no longer supported, installed booleans file is always used. Continuing...\n",
argv[0], argv[optind++]);
}
+ errno = 0;
if (init) {
if (is_selinux_enabled() == 1) {
/* SELinux is already enabled, we should not do an initial load again */
@@ -98,7 +99,12 @@ int main(int argc, char **argv)
else {
ret = selinux_mkload_policy(1);
}
- if (ret < 0) {
+
+ /* selinux_init_load_policy returns -1 if it did not load_policy
+ * On SELinux disabled system it will always return -1
+ * So check errno to see if anything went wrong
+ */
+ if (ret < 0 && errno != 0) {
char *path=policy_path();
fprintf(stderr, _("%s: Can't load policy file %s: %s\n"),
argv[0], path, strerror(errno));