/[baselayout]/trunk/src/runscript.c
Gentoo

Diff of /trunk/src/runscript.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2822 Revision 2823
69static void setup_selinux (int argc, char **argv); 69static void setup_selinux (int argc, char **argv);
70 70
71static void setup_selinux (int argc, char **argv) 71static void setup_selinux (int argc, char **argv)
72{ 72{
73 void *lib_handle = NULL; 73 void *lib_handle = NULL;
74
75 if (! rc_exists (SELINUX_LIB))
76 return;
74 77
75 lib_handle = dlopen (SELINUX_LIB, RTLD_NOW | RTLD_GLOBAL); 78 lib_handle = dlopen (SELINUX_LIB, RTLD_NOW | RTLD_GLOBAL);
76 if (lib_handle) { 79 if (! lib_handle) {
77 /* 80 eerror ("dlopen: %s", dlerror ());
78 * FIXME: the below code generates the warning 81 return;
79 * ISO C forbids assignment between function pointer and 'void *' 82 }
80 * which sucks ass 83
81 * http://www.opengroup.org/onlinepubs/009695399/functions/dlsym.html
82 */
83 selinux_run_init_old = (void (*)(void)) dlfunc (lib_handle, "selinux_runscript"); 84 selinux_run_init_old = (void (*)(void)) dlfunc (lib_handle, "selinux_runscript");
84 selinux_run_init_new = (void (*)(int, char **)) dlfunc (lib_handle, "selinux_runscript2"); 85 selinux_run_init_new = (void (*)(int, char **)) dlfunc (lib_handle, "selinux_runscript2");
85 86
86 /* Use new run_init if it rc_exists, else fall back to old */ 87 /* Use new run_init if it rc_exists, else fall back to old */
87 if (selinux_run_init_new) 88 if (selinux_run_init_new)
88 selinux_run_init_new (argc, argv); 89 selinux_run_init_new (argc, argv);
89 else if (selinux_run_init_old) 90 else if (selinux_run_init_old)
90 selinux_run_init_old (); 91 selinux_run_init_old ();
91 else 92 else
92 /* This shouldnt happen... probably corrupt lib */ 93 /* This shouldnt happen... probably corrupt lib */
93 eerrorx ("run_init is missing from runscript_selinux.so!"); 94 eerrorx ("run_init is missing from runscript_selinux.so!");
94 } 95
96 dlclose (lib_handle);
95} 97}
96#endif 98#endif
97 99
98static void handle_signal (int sig) 100static void handle_signal (int sig)
99{ 101{

Legend:
Removed from v.2822  
changed lines
  Added in v.2823

  ViewVC Help
Powered by ViewVC 1.1.20