X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flibcollectdclient%2Fclient.c;h=77819c217b6e8ae1272415974f88480ab17710b0;hb=584f57cc8cfb14cbcc45714db5dc87304ccb2a0e;hp=20015be9dff4faa9e71152b1d1a9eed21e12230c;hpb=79d834024d69d3b33e0fc4717b6560385b54cdd1;p=collectd.git diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index 20015be9..77819c21 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -258,6 +258,7 @@ static int lcc_send (lcc_connection_t *c, const char *command) /* {{{ */ lcc_set_errno (c, errno); return (-1); } + fflush(c->fh); return (0); } /* }}} int lcc_send */ @@ -286,7 +287,7 @@ static int lcc_receive (lcc_connection_t *c, /* {{{ */ * beginning of the message. */ ptr = NULL; errno = 0; - res.status = strtol (buffer, &ptr, 0); + res.status = (int) strtol (buffer, &ptr, 0); if ((errno != 0) || (ptr == &buffer[0])) { lcc_set_errno (c, errno); @@ -499,7 +500,6 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ if (fd < 0) { status = errno; - fd = -1; continue; } @@ -508,7 +508,6 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ { status = errno; close (fd); - fd = -1; continue; } @@ -517,7 +516,6 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ { status = errno; close (fd); - fd = -1; continue; } @@ -528,9 +526,11 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ if (status != 0) { lcc_set_errno (c, status); + freeaddrinfo (ai_res); return (-1); } + freeaddrinfo (ai_res); return (0); } /* }}} int lcc_open_netsocket */