summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mandi_daemon.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mandi_daemon.c b/src/mandi_daemon.c
index cf3bfbe..df60e4e 100644
--- a/src/mandi_daemon.c
+++ b/src/mandi_daemon.c
@@ -111,6 +111,7 @@ static void sigquit(int signum) {
static int mandi_daemon_init(mandi_daemon_t *daemon) {
plugin_t **ptr;
plugin_t *plugin;
+ int available_plugins = 0;
daemon->bus = mandi_daemon_get_system_bus();
if (!daemon->bus) {
@@ -129,12 +130,17 @@ static int mandi_daemon_init(mandi_daemon_t *daemon) {
for (ptr = plugins; *ptr; ptr++) {
plugin = *ptr;
- if (plugin->init(plugin, daemon->bus) != 0) {
+ if (plugin->init(plugin, daemon->bus) == 0) {
+ mandi_daemon_init_path(daemon, plugin);
+ available_plugins++;
+ } else {
fprintf(stderr, "unable to init \"%s\" plugin\n", plugin->name);
- mandi_daemon_exit(daemon, EXIT_FAILURE);
}
+ }
- mandi_daemon_init_path(daemon, plugin);
+ if (available_plugins == 0) {
+ fprintf(stderr, "unable to init any plugin, aborting\n", plugin->name);
+ mandi_daemon_exit(daemon, EXIT_FAILURE);
}
return 0;