aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-05-14 17:05:55 +0000
committerRoy Marples <roy@marples.name>2007-05-14 17:05:55 +0000
commitd0308aaecd1cb2f1c620a742f2fbaee00cb03c04 (patch)
tree5dab3c6c2afa6ca6f43ea9ba21ec0b3e379a9599 /src
parentb2e832418485f177804b42ff02c115db0bdbd50f (diff)
Use correct function casts. Use dlfunc where available to remove ISO warnings :)
Diffstat (limited to 'src')
-rw-r--r--src/rc-plugin.c14
-rw-r--r--src/runscript.c4
2 files changed, 11 insertions, 7 deletions
diff --git a/src/rc-plugin.c b/src/rc-plugin.c
index 2d3d7072..2c8bfff5 100644
--- a/src/rc-plugin.c
+++ b/src/rc-plugin.c
@@ -23,7 +23,7 @@ typedef struct plugin
{
char *name;
void *handle;
- int (*hook) (rc_hook_t hook, const char *name);
+ int (*hook) (rc_hook_t, const char *);
struct plugin *next;
} plugin_t;
@@ -47,7 +47,7 @@ void rc_plugin_load (void)
char *p = rc_strcatpaths (RC_PLUGINDIR, file, NULL);
void *h = dlopen (p, RTLD_LAZY);
char *func;
- void *f;
+ int (*fptr) (rc_hook_t, const char *);
int len;
if (! h) {
@@ -62,8 +62,12 @@ void rc_plugin_load (void)
func = rc_xmalloc (sizeof (char *) * len);
snprintf (func, len, "_%s_hook", file);
- f = dlsym (h, func);
- if (! f) {
+#ifdef __FreeBSD__
+ fptr = (int (*)(rc_hook_t, const char*)) dlfunc (h, func);
+#else
+ fptr = (int (*)(rc_hook_t, const char*)) dlsym (h, func);
+#endif
+ if (! fptr) {
eerror ("`%s' does not expose the symbol `%s'", p, func);
dlclose (h);
} else {
@@ -76,7 +80,7 @@ void rc_plugin_load (void)
memset (plugin, 0, sizeof (plugin_t));
plugin->name = rc_xstrdup (file);
plugin->handle = h;
- plugin->hook = f;
+ plugin->hook = fptr;
}
free (func);
diff --git a/src/runscript.c b/src/runscript.c
index b35474e1..ecbe34cc 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -80,8 +80,8 @@ static void setup_selinux (int argc, char **argv)
* which sucks ass
* http://www.opengroup.org/onlinepubs/009695399/functions/dlsym.html
*/
- selinux_run_init_old = dlsym (lib_handle, "selinux_runscript");
- selinux_run_init_new = dlsym (lib_handle, "selinux_runscript2");
+ selinux_run_init_old = (void (*)(void)) dlsym (lib_handle, "selinux_runscript");
+ selinux_run_init_new = (void (*)(int, char **)) dlsym (lib_handle, "selinux_runscript2");
/* Use new run_init if it rc_exists, else fall back to old */
if (selinux_run_init_new)