Skip to content

Commit

Permalink
pointer bug in influxdb output
Browse files Browse the repository at this point in the history
  • Loading branch information
lquenti committed Mar 4, 2024
1 parent e696340 commit 3aff2c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/elasticsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,9 @@ static void format_influx(char *linep, int lastCounter) {

for (int a=0; a < CLASSIFICATION_LAST; ++a) {
char *out;
if (!classification_type_to_str(a, out)) continue;
if (!classification_type_to_str(a, &out)) continue;
ptr += sprintf(ptr, "%s,%s", m_classifications, options.in_tags);
// TODO FIX ME IMPORTANTLY AS SOON AS IT WORKS
ptr += sprintf(ptr, ",type=%d ", out);
ptr += sprintf(ptr, ",type=%s ", out);
ptr += sprintf(ptr, "read=%d,write=%d",
monitor.classifications[monitor.timestep][a].classifications[1].count,
monitor.classifications[monitor.timestep][a].classifications[0].count
Expand Down
4 changes: 2 additions & 2 deletions src/iofs-monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ static int str_to_classification_type(const char *s, classification_type_t *out)
// unparsable...
return 0;
}
static int classification_type_to_str(const classification_type_t c, char *out) {
static int classification_type_to_str(const classification_type_t c, char **out) {
for (int i=0; i < sizeof(classification_lookup) / sizeof(classification_lookup[0]); ++i) {
if (c == classification_lookup[i].key) {
// Found it!
out = classification_lookup[i].val;
*out = classification_lookup[i].val;
return 1;
}
}
Expand Down

0 comments on commit 3aff2c7

Please sign in to comment.