X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_cmd_putnotif.c;h=145cd107c771b7330bcd20fa18e737a810e76000;hb=1fc00932fd49fa535551cc4bba09c4e4be059ab4;hp=e14a258f0c3a3d371c662607a0c5e556da29efd5;hpb=e1812f8e5c5f91328398c66b602d07ee7c6ede51;p=collectd.git diff --git a/src/utils_cmd_putnotif.c b/src/utils_cmd_putnotif.c index e14a258f..145cd107 100644 --- a/src/utils_cmd_putnotif.c +++ b/src/utils_cmd_putnotif.c @@ -29,14 +29,18 @@ #include "plugin.h" #include "utils_parse_option.h" +#include "utils_cmd_putnotif.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) {