Skip to contentSkip to conversation

selinux: fix 'defined but not used' warning

PATCH In review Alan Jenkins 2 participants 2 messages Oct 2, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

udev/lib/libudev.c +2 -2
index c2c5025..16cf860 100644
@@ -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)
 {
#1 lore raw
Quoted 3 lines · Alan Jenkins

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