summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2006-07-16 12:23:55 +0000
committerOlivier Blin <oblin@mandriva.com>2006-07-16 12:23:55 +0000
commit3289d436296cd25cf602a2fb0b8ed15958230bbc (patch)
treee8a87d19ffac449ba55829a29eae99f2432bc775
parentb2487e4afc13382419ce9bebb80a1f9d20e29f9c (diff)
downloadmandi-3289d436296cd25cf602a2fb0b8ed15958230bbc.tar
mandi-3289d436296cd25cf602a2fb0b8ed15958230bbc.tar.gz
mandi-3289d436296cd25cf602a2fb0b8ed15958230bbc.tar.bz2
mandi-3289d436296cd25cf602a2fb0b8ed15958230bbc.tar.xz
mandi-3289d436296cd25cf602a2fb0b8ed15958230bbc.zip
abort only if all plugin fail to init
-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;