Code

sensors plugin: Avoid assertion in ignorelist_match () when not configured.
[collectd.git] / src / network.c
index 54f9bfa3b43456dd1d02fd0b2b1104ca5d211a86..e9ba84bb4210037f0cae97a6612c3fe0ef319bb6 100644 (file)
@@ -215,7 +215,11 @@ int network_create_socket (const char *node, const char *service)
        DBG ("node = %s, service = %s", node, service);
 
        if (operating_mode == MODE_LOCAL || operating_mode == MODE_LOG)
+       {
+               syslog (LOG_WARNING, "network_create_socket: There is no point opening a socket when you are in mode `%s'.",
+                               operating_mode == MODE_LOCAL ? "Local" : "Log");
                return (-1);
+       }
 
        socklist_tail = socklist_head;
        while ((socklist_tail != NULL) && (socklist_tail->next != NULL))
@@ -280,6 +284,7 @@ int network_create_socket (const char *node, const char *service)
                {
                        if (network_bind_socket (se, ai_ptr) != 0)
                        {
+                               close (se->fd);
                                free (se->addr);
                                free (se);
                                continue;
@@ -447,7 +452,7 @@ int network_receive (char **host, char **type, char **inst, char **value)
        {
                syslog (LOG_WARNING, "Invalid message from `%s'", *host);
                free (*host); *host = NULL;
-               return (-1);
+               return (1);
        }
 
        if ((*type = strdup (fields[0])) == NULL)