From: Florian Forster Date: Thu, 18 Jun 2015 07:16:18 +0000 (+0200) Subject: powerdns plugin: Fix "Dead assignment" warning. X-Git-Tag: collectd-5.5.1~101^2~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=76ebdf2cc7b354847b76cc0a4b662d3f6ecafaa4;p=collectd.git powerdns plugin: Fix "Dead assignment" warning. --- diff --git a/src/powerdns.c b/src/powerdns.c index 81e253bf..11974aaa 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -447,6 +447,12 @@ static int powerdns_get_data_stream (list_item_t *item, /* {{{ */ timeout.tv_sec=5; timeout.tv_usec=0; status = setsockopt (sd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof (timeout)); + if (status != 0) + { + FUNC_ERROR ("setsockopt"); + close (sd); + return (-1); + } status = connect (sd, (struct sockaddr *) &item->sockaddr, sizeof (item->sockaddr)); @@ -494,7 +500,6 @@ static int powerdns_get_data_stream (list_item_t *item, /* {{{ */ buffer[buffer_size] = 0; } /* while (42) */ close (sd); - sd = -1; if (status < 0) {