summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/samples/HelloWorld.c2
-rw-r--r--src/rest-api.c15
2 files changed, 12 insertions, 5 deletions
diff --git a/plugins/samples/HelloWorld.c b/plugins/samples/HelloWorld.c
index 870225b1..2f6dc4d1 100644
--- a/plugins/samples/HelloWorld.c
+++ b/plugins/samples/HelloWorld.c
@@ -88,7 +88,7 @@ PUBLIC AFB_plugin *pluginRegister () {
AFB_plugin *plugin = malloc (sizeof (AFB_plugin));
plugin->type = AFB_PLUGIN_JSON;
plugin->info = "Application Framework Binder Service";
- plugin->prefix= "dbus";
+ plugin->prefix= "hello";
plugin->apis = pluginApis;
return (plugin);
};
diff --git a/src/rest-api.c b/src/rest-api.c
index 0a31e20e..c1a20f13 100644
--- a/src/rest-api.c
+++ b/src/rest-api.c
@@ -573,9 +573,11 @@ void initPlugins(AFB_session *session) {
afbJsonType = json_object_new_string (AFB_MSG_JTYPE);
int i = 0;
+ plugins = (AFB_plugin **) malloc (sizeof(AFB_plugin));
+
if ((dir = opendir(session->config->plugins)) == NULL) {
- fprintf(stderr, "Could not open plugin directory=%s\n", session->config->plugins);
- return;
+ fprintf(stderr, "Could not open plugin directory [%s], exiting...\n", session->config->plugins);
+ exit (-1);
}
while ((pluginDir = readdir(dir)) != NULL) {
@@ -601,10 +603,15 @@ void initPlugins(AFB_session *session) {
plugins[i] = (**pluginRegisterFct)();
i++;
}
- plugins[i++] = NULL;
+ plugins[i] = NULL;
closedir (dir);
-
+
+ if (plugins[0] == NULL) {
+ fprintf(stderr, "No plugins found, afb-daemon is unlikely to work in this configuration, exiting...\n");
+ exit (-1);
+ }
+
// complete plugins and save them within current sessions
session->plugins = RegisterJsonPlugins(plugins);
}