Merge branch 'collectd-4.2' into collectd-4.3
[collectd.git] / src / ping.c
index 3c70066..05f660b 100644 (file)
@@ -106,15 +106,18 @@ static void add_hosts (void)
                        hl_this = hl_this->next;
                }
        }
-}
+} /* void add_hosts */
 
 static int ping_init (void)
 {
+       if (pingobj == NULL)
+               return (-1);
+
        if (hosts != NULL)
                add_hosts ();
 
        return (0);
-}
+} /* int ping_init */
 
 static int ping_config (const char *key, const char *value)
 {
@@ -241,7 +244,7 @@ static int ping_read (void)
                number_of_hosts++;
        }
 
-       if ((number_of_hosts == 0) && (getuid != 0))
+       if ((number_of_hosts == 0) && (getuid () != 0))
        {
                ERROR ("ping plugin: All hosts failed. Try starting collectd as root.");
        }