diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:39 +0000 |
commit | 89f3604407aff8f4cb2ed958252c61e23c767e24 (patch) | |
tree | 7fbf408102cab051557d38193524d8c6e991d070 /web/api/formatters/charts2json.c | |
parent | Adding upstream version 1.34.1. (diff) | |
download | netdata-upstream/1.35.0.tar.xz netdata-upstream/1.35.0.zip |
Adding upstream version 1.35.0.upstream/1.35.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | web/api/formatters/charts2json.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/web/api/formatters/charts2json.c b/web/api/formatters/charts2json.c index 856ffb5eb..4325b6530 100644 --- a/web/api/formatters/charts2json.c +++ b/web/api/formatters/charts2json.c @@ -8,30 +8,30 @@ const char* get_release_channel() { static int use_stable = -1; if (use_stable == -1) { - char filename[FILENAME_MAX + 1]; + char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s/.environment", netdata_configured_user_config_dir); procfile *ff = procfile_open(filename, "=", PROCFILE_FLAG_DEFAULT); - if(!ff) { - use_stable=1; - } else { + if (ff) { procfile_set_quotes(ff, "'\""); ff = procfile_readall(ff); - if(!ff) { - use_stable=1; - } else { + if (ff) { unsigned int i; - for(i = 0; i < procfile_lines(ff); i++) { - if (!procfile_linewords(ff, i)) continue; - - if (!strcmp(procfile_lineword(ff, i, 0), "RELEASE_CHANNEL") && !strcmp(procfile_lineword(ff, i, 1), "stable")) { - use_stable = 1; + for (i = 0; i < procfile_lines(ff); i++) { + if (!procfile_linewords(ff, i)) + continue; + if (!strcmp(procfile_lineword(ff, i, 0), "RELEASE_CHANNEL")) { + if (!strcmp(procfile_lineword(ff, i, 1), "stable")) + use_stable = 1; + else if (!strcmp(procfile_lineword(ff, i, 1), "nightly")) + use_stable = 0; break; } } procfile_close(ff); - if (use_stable == -1) use_stable = 0; } } + if (use_stable == -1) + use_stable = strchr(program_version, '-') ? 0 : 1; } return (use_stable)?"stable":"nightly"; } @@ -150,7 +150,9 @@ struct array_printer { BUFFER *wb; }; -int print_collector(void *entry, void *data) { +static int print_collector_callback(const char *name, void *entry, void *data) { + (void)name; + struct array_printer *ap = (struct array_printer *)data; BUFFER *wb = ap->wb; struct collector *col=(struct collector *) entry; @@ -187,6 +189,6 @@ void chartcollectors2json(RRDHOST *host, BUFFER *wb) { .c = 0, .wb = wb }; - dictionary_get_all(dict, print_collector, &ap); + dictionary_walkthrough_read(dict, print_collector_callback, &ap); dictionary_destroy(dict); } |