summaryrefslogtreecommitdiff
path: root/plugins.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-05 14:14:56 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-05 14:16:00 +0200
commit3d5c761881717162a0757300adc769b1e5097d7b (patch)
treef97a93fc3692fb0910ad6de324febdd1b3dae9e4 /plugins.c
parent84963a9b7cce2435bf0bcf2cb3bb5df22bdc4155 (diff)
possible fix to plugin loader crash on ubuntu 9.x
Diffstat (limited to 'plugins.c')
-rw-r--r--plugins.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/plugins.c b/plugins.c
index 1fbacb7c..4062553f 100644
--- a/plugins.c
+++ b/plugins.c
@@ -299,6 +299,8 @@ plug_load_all (void) {
if (strcasecmp (&namelist[i]->d_name[l-3], ".so")) {
continue;
}
+ char d_name[256];
+ memcpy (d_name, namelist[i]->d_name, l+1);
// no blacklisted
const uint8_t *p = conf_blacklist_plugins;
while (*p) {
@@ -307,7 +309,7 @@ plug_load_all (void) {
e++;
}
if (l-3 == e-p) {
- if (!strncmp (p, namelist[i]->d_name, e-p)) {
+ if (!strncmp (p, d_name, e-p)) {
p = NULL;
break;
}
@@ -318,31 +320,31 @@ plug_load_all (void) {
}
}
if (!p) {
- fprintf (stderr, "plugin %s is blacklisted in config file\n", namelist[i]->d_name);
+ fprintf (stderr, "plugin %s is blacklisted in config file\n", d_name);
continue;
}
char fullname[1024];
strcpy (fullname, dirname);
strncat (fullname, "/", 1024);
- strncat (fullname, namelist[i]->d_name, 1024);
- printf ("loading plugin %s\n", namelist[i]->d_name);
+ strncat (fullname, d_name, 1024);
+ printf ("loading plugin %s\n", d_name);
void *handle = dlopen (fullname, RTLD_NOW);
if (!handle) {
fprintf (stderr, "dlopen error: %s\n", dlerror ());
continue;
}
- namelist[i]->d_name[l-3] = 0;
- printf ("module name is %s\n", namelist[i]->d_name);
- strcat (namelist[i]->d_name, "_load");
- DB_plugin_t *(*plug_load)(DB_functions_t *api) = dlsym (handle, namelist[i]->d_name);
+ d_name[l-3] = 0;
+ printf ("module name is %s\n", d_name);
+ strcat (d_name, "_load");
+ DB_plugin_t *(*plug_load)(DB_functions_t *api) = dlsym (handle, d_name);
if (!plug_load) {
fprintf (stderr, "dlsym error: %s\n", dlerror ());
dlclose (handle);
continue;
}
if (plug_init_plugin (plug_load, handle) < 0) {
- namelist[i]->d_name[l-3] = 0;
- fprintf (stderr, "plugin %s is incompatible with current version of deadbeef, please upgrade the plugin\n", namelist[i]->d_name);
+ d_name[l-3] = 0;
+ fprintf (stderr, "plugin %s is incompatible with current version of deadbeef, please upgrade the plugin\n", d_name);
dlclose (handle);
continue;
}