From 91a91d16426535a000e0730c970e628eb50437a8 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Mon, 5 Dec 2005 01:16:26 -0600 Subject: [PATCH] Flush chronyc output buffers. The following is a patch to chronyc that causes it to flush the buffers to stderr and stdout after executing each command. This is needed if you are controling chronyc from a program (i.e. chronyc's input and output descriptors are pipes which are being written/read by another program) and you do not want to block waiting for chronyc response which is trapped in a buffer! --- client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client.c b/client.c index 424877c7..a1d18d75 100644 --- a/client.c +++ b/client.c @@ -2319,7 +2319,11 @@ process_line(char *line) /* Check for line being blank */ p = line; while (*p && isspace((unsigned char)*p)) p++; - if (!*p) return quit; + if (!*p) { + fflush(stderr); + fflush(stdout); + return quit; + }; if (!strncmp(p, "offline", 7)) { do_normal_submit = process_cmd_offline(&tx_message, p+7); @@ -2480,7 +2484,8 @@ process_line(char *line) } } } - + fflush(stderr); + fflush(stdout); return quit; } -- 2.47.2