#include "utils_cache.h"
#include "utils_parse_option.h"
+#include "utils_cmd_getval.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; \
- }
+ 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)
{
const data_set_t *ds;
int status;
- int i;
+ size_t i;
if ((fh == NULL) || (buffer == NULL))
return (-1);
return (-1);
}
- if (ds->ds_num != values_num)
+ if ((size_t) ds->ds_num != values_num)
{
ERROR ("ds[%s]->ds_num = %i, "
"but uc_get_rate_by_name returned %u values.",