X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Futils_cmd_putnotif.c;h=530d153ea91437b0375b20eed65e85f426d5a5e8;hp=e14a258f0c3a3d371c662607a0c5e556da29efd5;hb=ca316d91e178412604ea8462dc60a8bc32cbfc87;hpb=681a607a4b1a95df1d53d3e6922ec70bd52f87cf diff --git a/src/utils_cmd_putnotif.c b/src/utils_cmd_putnotif.c index e14a258f..530d153e 100644 --- a/src/utils_cmd_putnotif.c +++ b/src/utils_cmd_putnotif.c @@ -31,12 +31,15 @@ #include "utils_parse_option.h" #define print_to_socket(fh, ...) \ - if (fprintf (fh, __VA_ARGS__) < 0) { \ - char errbuf[1024]; \ - WARNING ("handle_putnotif: failed to write to socket #%i: %s", \ - fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \ - return -1; \ - } + do { \ + if (fprintf (fh, __VA_ARGS__) < 0) { \ + char errbuf[1024]; \ + WARNING ("handle_putnotif: failed to write to socket #%i: %s", \ + fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \ + return -1; \ + } \ + fflush(fh); \ + } while (0) static int set_option_severity (notification_t *n, const char *value) {