diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2024-02-14 11:05:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-14 11:05:09 +0200 |
commit | 06796dc0b4738750dc239887c7e89364f5076fcf (patch) | |
tree | 48795783972dd70f62431e54007ac3b0a0c53147 | |
parent | b7086f0408e3a8aaef6cc15df05b4b9b334dd599 (diff) |
dyncfg: fix support for testing new jobs (#17009)
-rw-r--r-- | src/daemon/config/dyncfg-intercept.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/daemon/config/dyncfg-intercept.c b/src/daemon/config/dyncfg-intercept.c index 88638988fe..57134e05c8 100644 --- a/src/daemon/config/dyncfg-intercept.c +++ b/src/daemon/config/dyncfg-intercept.c @@ -181,11 +181,14 @@ static int dyncfg_intercept_early_error(struct rrd_function_execute *rfe, int rc } static const DICTIONARY_ITEM *dyncfg_get_template_of_new_job(const char *job_id) { - const char *colon = strrchr(job_id, ':'); + char id_copy[strlen(job_id) + 1]; + memcpy(id_copy, job_id, sizeof(id_copy)); + + char *colon = strrchr(id_copy, ':'); if(!colon) return NULL; - colon++; - const DICTIONARY_ITEM *item = dictionary_get_and_acquire_item(dyncfg_globals.nodes, colon); + *colon = '\0'; + const DICTIONARY_ITEM *item = dictionary_get_and_acquire_item(dyncfg_globals.nodes, id_copy); if(!item) return NULL; DYNCFG *df = dictionary_acquired_item_value(item); |