Due to the bit-wise check, the value for derive (0x30) matches the check
for gauge (0x10), too. This commit fixes the behavior by assigning other
numeric values to the defines.
if (matches_num < 2)
return (-1);
- value = strtoll (matches[1], &endptr, 0);
+ value = (derive_t) strtoll (matches[1], &endptr, 0);
if (matches[1] == endptr)
return (-1);
/*
* Defines
*/
-#define UTILS_MATCH_DS_TYPE_GAUGE 0x10
-#define UTILS_MATCH_DS_TYPE_COUNTER 0x20
-#define UTILS_MATCH_DS_TYPE_DERIVE 0x30
-#define UTILS_MATCH_DS_TYPE_ABSOLUTE 0x40
+#define UTILS_MATCH_DS_TYPE_GAUGE 0x10
+#define UTILS_MATCH_DS_TYPE_COUNTER 0x20
+#define UTILS_MATCH_DS_TYPE_DERIVE 0x40
+#define UTILS_MATCH_DS_TYPE_ABSOLUTE 0x80
#define UTILS_MATCH_CF_GAUGE_AVERAGE 0x01
#define UTILS_MATCH_CF_GAUGE_MIN 0x02