aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-09-12 13:32:50 +0200
committerToni Uhlig <matzeton@googlemail.com>2022-09-12 13:32:50 +0200
commit94aa02b298321005b6334262242c30eeb94549ae (patch)
treed80fe7bdad0f56e9fc31238cffa0c0047f74a32b
parent20ced3e6360dcc70ece4c7e7e98b986356388b36 (diff)
nDPIsrvd-collectd: Stdout should be unbuffered.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--examples/c-collectd/c-collectd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/c-collectd/c-collectd.c b/examples/c-collectd/c-collectd.c
index 0497824e6..29b060e60 100644
--- a/examples/c-collectd/c-collectd.c
+++ b/examples/c-collectd/c-collectd.c
@@ -711,6 +711,13 @@ int main(int argc, char ** argv)
LOG(LOG_DAEMON | LOG_NOTICE, "Collectd interval: %llu", collectd_interval_ull);
}
+ if (setvbuf(stdout, NULL, _IONBF, 0) != 0)
+ {
+ LOG(LOG_DAEMON | LOG_ERR,
+ "Could not set stdout unbuffered: %s. Collectd may receive too old PUTVALs and complain.",
+ strerror(errno));
+ }
+
enum nDPIsrvd_connect_return connect_ret = nDPIsrvd_connect(sock);
if (connect_ret != CONNECT_OK)
{