dyncfg: fix support for testing new jobs (#17009)
Costa Tsaousis committed
Feb 14, 2024 at 11:05 UTC
06796dc0b4738750dc239887c7e89364f5076fcf
1 file changed
+6
-3
src/daemon/config/dyncfg-intercept.c
+6
-3
@@ -181,11 +181,14 @@ static int dyncfg_intercept_early_error(struct rrd_function_execute *rfe, int rc
181
}
182
183
static const DICTIONARY_ITEM *dyncfg_get_template_of_new_job(const char *job_id) {
184
- const char *colon = strrchr(job_id, ':');
184
+ char id_copy[strlen(job_id) + 1];
185
+ memcpy(id_copy, job_id, sizeof(id_copy));
186
+
187
+ char *colon = strrchr(id_copy, ':');
188
if(!colon) return NULL;
189
187
- colon++;
188
- const DICTIONARY_ITEM *item = dictionary_get_and_acquire_item(dyncfg_globals.nodes, colon);
190
+ *colon = '\0';
191
+ const DICTIONARY_ITEM *item = dictionary_get_and_acquire_item(dyncfg_globals.nodes, id_copy);
192
if(!item) return NULL;
193
194
DYNCFG *df = dictionary_acquired_item_value(item);