**/
#include "collectd.h"
-#include "common.h"
+#include "common.h"
#include "plugin.h"
#include "configfile.h"
const char *str;
struct addrinfo *ai_list;
- struct addrinfo *ai_ptr;
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);
return (-1);
}
- for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
+ for (struct addrinfo *ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
{
if (ai_ptr->ai_canonname == NULL)
continue;
* something wrong.
*/
if (init_global_variables () != 0)
- return (1);
+ exit (EXIT_FAILURE);
if (test_config)
return (0);