summaryrefslogtreecommitdiff
path: root/src/rc/rc-plugin.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-17 13:25:56 +0000
committerRoy Marples <roy@marples.name>2008-03-17 13:25:56 +0000
commit4c1466642351ddb01cc7353601153a79326f18f7 (patch)
treecb9da1a90aa9480ef276626f40c556379222ec51 /src/rc/rc-plugin.c
parent50a7697bf207e4919ce893bfc1604fd3a9d807de (diff)
downloadopenrc-4c1466642351ddb01cc7353601153a79326f18f7.tar.gz
openrc-4c1466642351ddb01cc7353601153a79326f18f7.tar.bz2
openrc-4c1466642351ddb01cc7353601153a79326f18f7.tar.xz
Punt the rc_strcatpaths function and use snprintf instead to save on expensive malloc calls.
Diffstat (limited to 'src/rc/rc-plugin.c')
-rw-r--r--src/rc/rc-plugin.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c
index f0ee5a6..034f79d 100644
--- a/src/rc/rc-plugin.c
+++ b/src/rc/rc-plugin.c
@@ -79,7 +79,7 @@ void rc_plugin_load(void)
DIR *dp;
struct dirent *d;
PLUGIN *plugin;
- char *p;
+ char file[PATH_MAX];
void *h;
int (*fptr)(RC_HOOK, const char *);
@@ -96,9 +96,8 @@ void rc_plugin_load(void)
if (d->d_name[0] == '.')
continue;
- p = rc_strcatpaths(RC_PLUGINDIR, d->d_name, NULL);
- h = dlopen(p, RTLD_LAZY);
- free(p);
+ snprintf(file, sizeof(file), RC_PLUGINDIR "/%s", d->d_name);
+ h = dlopen(file, RTLD_LAZY);
if (! h) {
eerror("dlopen: %s", dlerror());
continue;