network plugin: Explicitly initialize "fd_num" to zero.
authorFlorian Forster <octo@collectd.org>
Wed, 17 Jun 2015 05:50:46 +0000 (07:50 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 17 Jun 2015 05:53:20 +0000 (07:53 +0200)
I have the feeling that initialization via memset() and unions in the sockent
structure confuse clang's scan-build.

src/network.c

index 5d485ba..c5fd256 100644 (file)
@@ -2017,6 +2017,7 @@ static sockent_t *sockent_create (int type) /* {{{ */
        if (type == SOCKENT_TYPE_SERVER)
        {
                se->data.server.fd = NULL;
+               se->data.server.fd_num = 0;
 #if HAVE_LIBGCRYPT
                se->data.server.security_level = SECURITY_LEVEL_NONE;
                se->data.server.auth_file = NULL;
@@ -2212,6 +2213,9 @@ static int sockent_server_listen (sockent_t *se) /* {{{ */
        if (se == NULL)
                return (-1);
 
+       assert (se->data.server.fd == NULL);
+       assert (se->data.server.fd_num == 0);
+
         node = se->node;
         service = se->service;