Code

openldap: revert change leading to use of uninitialised variable
authorMarc Fournier <marc.fournier@camptocamp.com>
Tue, 1 Jul 2014 15:29:45 +0000 (17:29 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 29 Aug 2014 13:09:49 +0000 (15:09 +0200)
this was preventing build with -Wall

src/openldap.c

index fd029f4936ee9525ed3989839f9d76d141298cf8..5a045781b194947e92cba016b814c50a544be68c 100644 (file)
@@ -218,6 +218,7 @@ static int ldap_read_host (user_data_t *ud) /* {{{ */
                        unsigned long long counter = 0;
                        unsigned long long opc = 0;
                        unsigned long long opi = 0;
+                       unsigned long long info = 0;
 
                        struct berval counter_data;
                        struct berval opc_data;
@@ -258,8 +259,7 @@ static int ldap_read_host (user_data_t *ud) /* {{{ */
                                "monitoredInfo")) != NULL)
                        {
                                info_data = *info_list[0];
-                               // don't convert search result to long long at this point,
-                               // because this field is often populated with non-numerical data.
+                               info = atoll (info_data.bv_val);
                        }
 
                        if (strcmp (dn, "cn=Total,cn=Connections,cn=Monitor")
@@ -448,35 +448,35 @@ static int ldap_read_host (user_data_t *ud) /* {{{ */
                                        == 0)
                        {
                                ldap_submit_gauge ("threads", "threads-open",
-                                       atoll (info_data.bv_val), st);
+                                       info, st);
                        }
                        else if (strcmp (dn,
                                        "cn=Starting,cn=Threads,cn=Monitor")
                                        == 0)
                        {
                                ldap_submit_gauge ("threads", "threads-starting",
-                                       atoll (info_data.bv_val), st);
+                                       info, st);
                        }
                        else if (strcmp (dn,
                                        "cn=Active,cn=Threads,cn=Monitor")
                                        == 0)
                        {
                                ldap_submit_gauge ("threads", "threads-active",
-                                       atoll (info_data.bv_val), st);
+                                       info, st);
                        }
                        else if (strcmp (dn,
                                        "cn=Pending,cn=Threads,cn=Monitor")
                                        == 0)
                        {
                                ldap_submit_gauge ("threads", "threads-pending",
-                                       atoll (info_data.bv_val), st);
+                                       info, st);
                        }
                        else if (strcmp (dn,
                                        "cn=Backload,cn=Threads,cn=Monitor")
                                        == 0)
                        {
                                ldap_submit_gauge ("threads", "threads-backload",
-                                       atoll (info_data.bv_val), st);
+                                       info, st);
                        }
                        else if (strcmp (dn,
                                        "cn=Read,cn=Waiters,cn=Monitor")