summaryrefslogtreecommitdiff
path: root/plugins.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-04-25 15:42:00 +0200
committerGravatar waker <wakeroid@gmail.com>2012-04-25 15:42:00 +0200
commitda656dc2bf463b34f946fce366ae1c83da2cdb59 (patch)
tree18503f7c4f0bd9f4443822bc670b53bc4c7f66e3 /plugins.c
parent27e045ccce17bf3e005721f3efd52e26e23419f2 (diff)
don't print bogus errors during plugin search
Diffstat (limited to 'plugins.c')
-rw-r--r--plugins.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins.c b/plugins.c
index d19139ff..522930de 100644
--- a/plugins.c
+++ b/plugins.c
@@ -21,8 +21,8 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-//#include <alloca.h>
#include <string.h>
+#include <sys/stat.h>
#ifndef __linux__
#define _POSIX_C_SOURCE 1
#endif
@@ -567,6 +567,13 @@ static int
load_plugin (const char *plugdir, char *d_name, int l) {
char fullname[PATH_MAX];
snprintf (fullname, PATH_MAX, "%s/%s", plugdir, d_name);
+
+ // check if the file exists, to avoid printing bogus errors
+ struct stat s;
+ if (0 != stat (fullname, &s)) {
+ return -1;
+ }
+
trace ("loading plugin %s/%s\n", plugdir, d_name);
void *handle = dlopen (fullname, RTLD_NOW);
if (!handle) {