X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcollectd.c;h=6b7c413635631f2d10626e0def0fb6f28f9e3a12;hb=e56c1e570ff8d4e8fe732f9d74f11217479fdd7b;hp=60ce91fd89b3b06972db7be66bb6c0ee0b96c589;hpb=79963d13c1884d1d92667cc502ad20758b084a12;p=collectd.git diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 60ce91fd..6b7c4136 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -92,7 +92,7 @@ static int init_hostname(void) { int status; str = global_option_get("Hostname"); - if (str != NULL) { + if ((str != NULL) && (str[0] != 0)) { sstrncpy(hostname_g, str, sizeof(hostname_g)); return (0); } @@ -304,7 +304,6 @@ static int do_loop(void) { wait_until = cdtime() + interval; while (loop == 0) { - struct timespec ts_wait = {0, 0}; cdtime_t now; #if HAVE_LIBKSTAT @@ -323,7 +322,7 @@ static int do_loop(void) { continue; } - CDTIME_T_TO_TIMESPEC(wait_until - now, &ts_wait); + struct timespec ts_wait = CDTIME_T_TO_TIMESPEC(wait_until - now); wait_until = wait_until + interval; while ((loop == 0) && (nanosleep(&ts_wait, &ts_wait) != 0)) { @@ -522,7 +521,7 @@ int main(int argc, char **argv) { */ if (cf_read(configfile)) { fprintf(stderr, "Error: Reading the config file failed!\n" - "Read the syslog for details.\n"); + "Read the logs for details.\n"); return (1); } @@ -546,7 +545,7 @@ int main(int argc, char **argv) { * something wrong. */ if (init_global_variables() != 0) - return (1); + exit(EXIT_FAILURE); if (test_config) return (0);