apcups plugin: Handle "END APC" lines correctly and stop reading.
authorFlorian Forster <octo@collectd.org>
Mon, 8 Jun 2015 10:34:41 +0000 (12:34 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 8 Jun 2015 10:34:41 +0000 (12:34 +0200)
Fixes: #617

src/apcups.c

index 7738653..66fe45e 100644 (file)
@@ -325,6 +325,9 @@ static int apc_query_server (char const *node, char const *service,
                printf ("net_recv = `%s';\n", recvline);
 #endif /* if APCMAIN */
 
+               if (strncmp ("END APC", recvline, strlen ("END APC")) == 0)
+                       break;
+
                toksaveptr = NULL;
                tokptr = strtok_r (recvline, " :\t", &toksaveptr);
                while (tokptr != NULL)