Plug a leek for non selinux linux systems

This commit is contained in:
Roy Marples 2007-08-08 03:07:42 +00:00
parent 30853d7473
commit 94c6ff7bb7

View File

@ -72,14 +72,15 @@ static void setup_selinux (int argc, char **argv)
{ {
void *lib_handle = NULL; void *lib_handle = NULL;
if (! rc_exists (SELINUX_LIB))
return;
lib_handle = dlopen (SELINUX_LIB, RTLD_NOW | RTLD_GLOBAL); lib_handle = dlopen (SELINUX_LIB, RTLD_NOW | RTLD_GLOBAL);
if (lib_handle) { if (! lib_handle) {
/* eerror ("dlopen: %s", dlerror ());
* FIXME: the below code generates the warning return;
* ISO C forbids assignment between function pointer and 'void *' }
* which sucks ass
* http://www.opengroup.org/onlinepubs/009695399/functions/dlsym.html
*/
selinux_run_init_old = (void (*)(void)) dlfunc (lib_handle, "selinux_runscript"); selinux_run_init_old = (void (*)(void)) dlfunc (lib_handle, "selinux_runscript");
selinux_run_init_new = (void (*)(int, char **)) dlfunc (lib_handle, "selinux_runscript2"); selinux_run_init_new = (void (*)(int, char **)) dlfunc (lib_handle, "selinux_runscript2");
@ -91,7 +92,8 @@ static void setup_selinux (int argc, char **argv)
else else
/* This shouldnt happen... probably corrupt lib */ /* This shouldnt happen... probably corrupt lib */
eerrorx ("run_init is missing from runscript_selinux.so!"); eerrorx ("run_init is missing from runscript_selinux.so!");
}
dlclose (lib_handle);
} }
#endif #endif