summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 993900f)
raw | patch | inline | side by side (parent: 993900f)
author | Yoga Ramalingam <yramalingam1@bloomberg.net> | |
Mon, 1 Dec 2014 14:55:10 +0000 (09:55 -0500) | ||
committer | Yoga Ramalingam <yramalingam1@bloomberg.net> | |
Mon, 1 Dec 2014 15:00:14 +0000 (10:00 -0500) |
diff --git a/src/utils_cmd_flush.c b/src/utils_cmd_flush.c
index c35aeb04c1b67b01f3a0cd857795f5944e1b1d44..b84e8de5e1447e0cd04bf33ad9bb04f131896aa8 100644 (file)
--- a/src/utils_cmd_flush.c
+++ b/src/utils_cmd_flush.c
#include "utils_parse_option.h"
#define print_to_socket(fh, ...) \
- if (fprintf (fh, __VA_ARGS__) < 0) { \
- char errbuf[1024]; \
- WARNING ("handle_flush: failed to write to socket #%i: %s", \
- fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
- return -1; \
- } \
- fflush(fh);
+ do { \
+ if (fprintf (fh, __VA_ARGS__) < 0) { \
+ char errbuf[1024]; \
+ WARNING ("handle_flush: failed to write to socket #%i: %s", \
+ fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+ return -1; \
+ } \
+ fflush(fh); \
+ } while (0);
static int add_to_array (char ***array, int *array_num, char *value)
{
diff --git a/src/utils_cmd_getval.c b/src/utils_cmd_getval.c
index 9de66df33173c207910bc360d2987ef80735f57e..cbdd617c79b17e3ed34e7b62143bb24d017c07cc 100644 (file)
--- a/src/utils_cmd_getval.c
+++ b/src/utils_cmd_getval.c
#include "utils_parse_option.h"
#define print_to_socket(fh, ...) \
- if (fprintf (fh, __VA_ARGS__) < 0) { \
- char errbuf[1024]; \
- WARNING ("handle_getval: failed to write to socket #%i: %s", \
- fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
- return -1; \
- } \
- fflush(fh);
+ do { \
+ if (fprintf (fh, __VA_ARGS__) < 0) { \
+ char errbuf[1024]; \
+ WARNING ("handle_getval: failed to write to socket #%i: %s", \
+ fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+ return -1; \
+ } \
+ fflush(fh); \
+ } while (0);
int handle_getval (FILE *fh, char *buffer)
{
index 864e5f440a002c5dc516c1932c3f555ebd819368..13906c18430b492f5923a76d8fe2a089c844006b 100644 (file)
--- a/src/utils_cmd_listval.c
+++ b/src/utils_cmd_listval.c
} while (0)
#define print_to_socket(fh, ...) \
- if (fprintf (fh, __VA_ARGS__) < 0) { \
- char errbuf[1024]; \
- WARNING ("handle_listval: failed to write to socket #%i: %s", \
- fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
- free_everything_and_return (-1); \
- } \
- fflush(fh);
+ do { \
+ if (fprintf (fh, __VA_ARGS__) < 0) { \
+ char errbuf[1024]; \
+ WARNING ("handle_listval: failed to write to socket #%i: %s", \
+ fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+ free_everything_and_return (-1); \
+ } \
+ fflush(fh); \
+ } while (0);
int handle_listval (FILE *fh, char *buffer)
{
index d09eeb3ee75eba0eabb554f784f287968b4239c9..f8e734de6f202d21c328b436686681e4866baf78 100644 (file)
--- a/src/utils_cmd_putnotif.c
+++ b/src/utils_cmd_putnotif.c
#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; \
- } \
- fflush(fh);
+ 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)
{
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index d579b6e84e2c6c86066571aed8cd8605103060f6..2522819d5f7b0a92be0eecd2eb1b6451ec4a5689 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
#include "utils_parse_option.h"
#define print_to_socket(fh, ...) \
- if (fprintf (fh, __VA_ARGS__) < 0) { \
- char errbuf[1024]; \
- WARNING ("handle_putval: failed to write to socket #%i: %s", \
- fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
- return -1; \
- } \
- fflush(fh);
+ do { \
+ if (fprintf (fh, __VA_ARGS__) < 0) { \
+ char errbuf[1024]; \
+ WARNING ("handle_putval: failed to write to socket #%i: %s", \
+ fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+ return -1; \
+ } \
+ fflush(fh); \
+ } while (0);
static int dispatch_values (const data_set_t *ds, value_list_t *vl,
FILE *fh, char *buffer)