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)
(Continue reading)

Kay Sievers | 2 Oct 18:56
Gravatar

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

On Thu, Oct 2, 2008 at 6:29 PM, Alan Jenkins
<alan-jenkins <at> tuffmail.co.uk> wrote:
> selinux is initialized lazily, so if selinux is disabled then selinux_init will never be called.
>
> This lets udev compile with -Werror again.

Oh, I just ripped out that crap an hour ago, and use it only where
needed. Even "Hello world" will initialize selinux on startup. I was
tired seeing it parsing /proc/mounts and whatever else in strace. So
much for "lazy" init. :)

Thanks,
Kay
--
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