projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7c63535
)
mqtt plugin: Fix invalid symbols in topic name.
author
Denys Fedoryshchenko
<denys@visp.net.lb>
Sun, 5 Feb 2017 19:40:33 +0000
(19:40 +0000)
committer
Sebastian Andrzej Siewior
<sebastian@breakpoint.cc>
Sun, 5 Feb 2017 19:40:33 +0000
(19:40 +0000)
Gbp-Pq: Name mqtt_invalid_symbols.patch
src/mqtt.c
patch
|
blob
|
history
diff --git
a/src/mqtt.c
b/src/mqtt.c
index 7e6ce72284e04fcf82c6cb2bb7df1d92467b1ccf..315974b6f49a8b6b7d85a59427de1f0cc9a6026f 100644
(file)
--- a/
src/mqtt.c
+++ b/
src/mqtt.c
@@
-462,6
+462,7
@@
static int format_topic(char *buf, size_t buf_len, data_set_t const *ds,
value_list_t const *vl, mqtt_client_conf_t *conf) {
char name[MQTT_MAX_TOPIC_SIZE];
int status;
+ char *c;
if ((conf->topic_prefix == NULL) || (conf->topic_prefix[0] == 0))
return (FORMAT_VL(buf, buf_len, vl));
@@
-474,6
+475,10
@@
static int format_topic(char *buf, size_t buf_len, data_set_t const *ds,
if ((status < 0) || (((size_t)status) >= buf_len))
return (ENOMEM);
+ while((c = strchr(buf, '#')) || (c = strchr(buf, '+'))) {
+ *c = '_';
+ }
+
return (0);
} /* int format_topic */