From d6fd462604f590acdc7c2d3d70a9f9c087ba8b1b Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 4 Feb 2007 10:14:35 +0100 Subject: [PATCH] plugin interface: If an init-function fails, write an error to syslog and remove the read function. --- src/plugin.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugin.c b/src/plugin.c index 2daeea9f..1a029e40 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -317,6 +317,7 @@ void plugin_init_all (void) { int (*callback) (void); llentry_t *le; + int status; gethostname (hostname, sizeof (hostname)); @@ -327,7 +328,16 @@ void plugin_init_all (void) while (le != NULL) { callback = le->value; - (*callback) (); + status = (*callback) (); + + if (status != 0) + { + syslog (LOG_ERR, "Initialization of plugin `%s' " + "failed with status %i. " + "Plugin will be unloaded. TODO!", + le->key, status); + plugin_unregister_read (le->key); + } le = le->next; } -- 2.11.0