X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fdaemon%2Fcollectd.c;h=a72ff35f2fc21ec042e809d64967100f35f5a9fd;hb=ba6141349270c4ca127e9e0e6e83fc3c6460cf5c;hp=6f299174ad8ea38af32fc630d47f208905864dea;hpb=50345eec33951b964e2829e83c30399b71f2baba;p=collectd.git diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 6f299174..a72ff35f 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -196,7 +196,7 @@ static int change_basedir (const char *orig_dir) while ((dirlen > 0) && (dir[dirlen - 1] == '/')) dir[--dirlen] = '\0'; - if (dirlen <= 0) { + if (dirlen == 0) { free (dir); return (-1); } @@ -332,9 +332,7 @@ static int do_init (void) } #endif - plugin_init_all (); - - return (0); + return plugin_init_all (); } /* int do_init () */ @@ -388,8 +386,7 @@ static int do_loop (void) static int do_shutdown (void) { - plugin_shutdown_all (); - return (0); + return plugin_shutdown_all (); } /* int do_shutdown */ #if COLLECT_DAEMON @@ -729,12 +726,19 @@ int main (int argc, char **argv) /* * run the actual loops */ - do_init (); + if (do_init () != 0) + { + ERROR ("Error: one or more plugin init callbacks failed."); + exit_status = 1; + } if (test_readall) { if (plugin_read_all_once () != 0) + { + ERROR ("Error: one or more plugin read callbacks failed."); exit_status = 1; + } } else { @@ -745,7 +749,11 @@ int main (int argc, char **argv) /* close syslog */ INFO ("Exiting normally."); - do_shutdown (); + if (do_shutdown () != 0) + { + ERROR ("Error: one or more plugin shutdown callbacks failed."); + exit_status = 1; + } #if COLLECT_DAEMON if (daemonize)