X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flibcollectdclient%2Fclient.c;h=0f56bd239891fc3e35b4ddd76461074994356c22;hb=b4cc5c7399adf79198aea816d44a42df25431d15;hp=726f25d424b2476f84ddaa3584d4e8f91cdf7476;hpb=51a4e62d7d0e73d8d5822efaef1e3218b5ad0373;p=collectd.git diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index 726f25d4..0f56bd23 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -84,7 +84,7 @@ _b[sizeof (_b) - 1] = 0; \ SSTRCAT ((d), _b); \ } while (0) - + #define LCC_SET_ERRSTR(c, ...) do { \ snprintf ((c)->errbuf, sizeof ((c)->errbuf), __VA_ARGS__); \ @@ -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 */ @@ -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 */