Alan Jenkins | 2 Oct 18:25

[PATCH] selinux: fix 'defined but not used' warning

selinux is initialized lazily, so if selinux is disabled then selinux_init will never be called.

This lets udev compile with -Werror again.

Signed-off-by: Alan Jenkins <alan-jenkins <at> tuffmail.co.uk>

diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c
index c2c5025..16cf860 100644
--- a/udev/lib/libudev.c
+++ b/udev/lib/libudev.c
@@ -72,9 +72,9 @@ static void log_stderr(struct udev *udev,
 	vfprintf(stderr, format, args);
 }

+#ifdef USE_SELINUX
 static void selinux_init(struct udev *udev)
 {
-#ifdef USE_SELINUX
 	/*
 	 * record the present security context, for file-creation
 	 * restoration creation purposes.
@@ -89,8 +89,8 @@ static void selinux_init(struct udev *udev)
 		}
 	}
 	udev->selinux_initialized = 1;
-#endif
 }
+#endif

 void *udev_get_userdata(struct udev *udev)
 {

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane