projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1548 from bbczeuz/zseng_dev_chrony
[collectd.git]
/
src
/
daemon
/
collectd.c
diff --git
a/src/daemon/collectd.c
b/src/daemon/collectd.c
index
a745d7d
..
a72ff35
100644
(file)
--- 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';
while ((dirlen > 0) && (dir[dirlen - 1] == '/'))
dir[--dirlen] = '\0';
- if (dirlen
<
= 0) {
+ if (dirlen
=
= 0) {
free (dir);
return (-1);
}
free (dir);
return (-1);
}
@@
-269,6
+269,7
@@
static void update_kstat (void)
/* TODO
* Remove all settings but `-f' and `-C'
*/
/* TODO
* Remove all settings but `-f' and `-C'
*/
+__attribute__((noreturn))
static void exit_usage (int status)
{
printf ("Usage: "PACKAGE_NAME" [OPTIONS]\n\n"
static void exit_usage (int status)
{
printf ("Usage: "PACKAGE_NAME" [OPTIONS]\n\n"
@@
-331,9
+332,7
@@
static int do_init (void)
}
#endif
}
#endif
- plugin_init_all ();
-
- return (0);
+ return plugin_init_all ();
} /* int do_init () */
} /* int do_init () */
@@
-387,8
+386,7
@@
static int do_loop (void)
static int do_shutdown (void)
{
static int do_shutdown (void)
{
- plugin_shutdown_all ();
- return (0);
+ return plugin_shutdown_all ();
} /* int do_shutdown */
#if COLLECT_DAEMON
} /* int do_shutdown */
#if COLLECT_DAEMON
@@
-518,7
+516,7
@@
int main (int argc, char **argv)
struct sigaction sig_term_action;
struct sigaction sig_usr1_action;
struct sigaction sig_pipe_action;
struct sigaction sig_term_action;
struct sigaction sig_usr1_action;
struct sigaction sig_pipe_action;
- char *configfile = CONFIGFILE;
+ c
onst c
har *configfile = CONFIGFILE;
int test_config = 0;
int test_readall = 0;
const char *basedir;
int test_config = 0;
int test_readall = 0;
const char *basedir;
@@
-728,12
+726,19
@@
int main (int argc, char **argv)
/*
* run the actual loops
*/
/*
* 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)
if (test_readall)
{
if (plugin_read_all_once () != 0)
+ {
+ ERROR ("Error: one or more plugin read callbacks failed.");
exit_status = 1;
exit_status = 1;
+ }
}
else
{
}
else
{
@@
-744,7
+749,11
@@
int main (int argc, char **argv)
/* close syslog */
INFO ("Exiting normally.");
/* 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)
#if COLLECT_DAEMON
if (daemonize)