projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
collectdctl: Explicitly cast "long" to "int". This might be a problem on 32bit archit...
[collectd.git]
/
src
/
collectdctl.c
diff --git
a/src/collectdctl.c
b/src/collectdctl.c
index
adf45c9
..
53bd618
100644
(file)
--- a/
src/collectdctl.c
+++ b/
src/collectdctl.c
@@
-33,6
+33,8
@@
#include <getopt.h>
#include <getopt.h>
+#include <math.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-239,7
+241,7
@@
static int flush (lcc_connection_t *c, int argc, char **argv)
if (strcasecmp (key, "timeout") == 0) {
char *endptr = NULL;
if (strcasecmp (key, "timeout") == 0) {
char *endptr = NULL;
- timeout = strtol (value, &endptr, 0);
+ timeout =
(int)
strtol (value, &endptr, 0);
if (endptr == value) {
fprintf (stderr, "ERROR: Failed to parse timeout as number: %s.\n",
if (endptr == value) {
fprintf (stderr, "ERROR: Failed to parse timeout as number: %s.\n",
@@
-271,6
+273,10
@@
static int flush (lcc_connection_t *c, int argc, char **argv)
if (status != 0)
BAIL_OUT (status);
}
if (status != 0)
BAIL_OUT (status);
}
+ else {
+ fprintf (stderr, "ERROR: flush: Unknown option `%s'.\n", key);
+ BAIL_OUT (-1);
+ }
}
if (plugins_num == 0) {
}
if (plugins_num == 0) {
@@
-465,7
+471,12
@@
static int putval (lcc_connection_t *c, int argc, char **argv)
* anyway. Also, lcc uses the type information for formatting the
* number only, so the real meaning does not matter. -tokkee */
dot = strchr (value, (int)'.');
* anyway. Also, lcc uses the type information for formatting the
* number only, so the real meaning does not matter. -tokkee */
dot = strchr (value, (int)'.');
- if (dot) { /* floating point value */
+ endptr = NULL;
+ if (strcasecmp (value, "U") == 0) {
+ values[values_len].gauge = NAN;
+ values_types[values_len] = LCC_TYPE_GAUGE;
+ }
+ else if (dot) { /* floating point value */
values[values_len].gauge = strtod (value, &endptr);
values_types[values_len] = LCC_TYPE_GAUGE;
}
values[values_len].gauge = strtod (value, &endptr);
values_types[values_len] = LCC_TYPE_GAUGE;
}