X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flibcollectdclient%2Fclient.c;h=802e6439d8ac633d7ec6245470f614904573d4da;hb=f0b9430b0c0f45ada6f655dd4b9c64a8cbdf8d66;hp=850edaaff45841d82c1a7536258e26a74d9229a1;hpb=5131a49ad0584aa22282aacf72b6e4ca75356bae;p=collectd.git diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index 850edaaf..802e6439 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 */ @@ -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 */ @@ -767,11 +767,11 @@ int lcc_putval (lcc_connection_t *c, const lcc_value_list_t *vl) /* {{{ */ SSTRCATF (command, "PUTVAL %s", lcc_strescape (ident_esc, ident_str, sizeof (ident_esc))); - if (vl->interval > 0) - SSTRCATF (command, " interval=%i", vl->interval); + if (vl->interval > 0.0) + SSTRCATF (command, " interval=%.3f", vl->interval); - if (vl->time > 0) - SSTRCATF (command, " %u", (unsigned int) vl->time); + if (vl->time > 0.0) + SSTRCATF (command, " %.3f", vl->time); else SSTRCAT (command, " N");