mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-06-09 08:42:17 -04:00
Remove troublesome symbols from output (#2240)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Spellcheck / codespell (push) Has been cancelled
Tests / Running unit and integrationt tests (push) Has been cancelled
Tests / Running rpm build test on almalinux:9 (push) Has been cancelled
Tests / Running rpm build test on fedora:latest (push) Has been cancelled
Tests / Running rpm build test on rockylinux:8 (push) Has been cancelled
Tests Debian:Testing and Fedora:Rawhide / Running unit and integrationt tests (push) Has been cancelled
Tests Debian:Testing and Fedora:Rawhide / Running rpm build test on fedora:rawhide (push) Has been cancelled
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Spellcheck / codespell (push) Has been cancelled
Tests / Running unit and integrationt tests (push) Has been cancelled
Tests / Running rpm build test on almalinux:9 (push) Has been cancelled
Tests / Running rpm build test on fedora:latest (push) Has been cancelled
Tests / Running rpm build test on rockylinux:8 (push) Has been cancelled
Tests Debian:Testing and Fedora:Rawhide / Running unit and integrationt tests (push) Has been cancelled
Tests Debian:Testing and Fedora:Rawhide / Running rpm build test on fedora:rawhide (push) Has been cancelled
Co-authored-by: Lorenz Kästle <lorenz.kaestle@netways.de>
This commit is contained in:
parent
a9e23d05a6
commit
2d4f98f50b
1 changed files with 17 additions and 0 deletions
17
lib/output.c
17
lib/output.c
|
|
@ -259,6 +259,21 @@ mp_state_enum mp_eval_check_default(const mp_check check) {
|
|||
return result;
|
||||
}
|
||||
|
||||
// Remove troublesome symbols from plugin output
|
||||
char *sanitize_output_insitu(char *input) {
|
||||
if (input == NULL) {
|
||||
return input;
|
||||
}
|
||||
|
||||
for (char *walker = input; *walker != '\0'; walker++) {
|
||||
if (*walker == '|') {
|
||||
*walker = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate output string for a mp_check object
|
||||
* Non static to be available for testing functions
|
||||
|
|
@ -299,6 +314,8 @@ char *mp_fmt_output(mp_check check) {
|
|||
subchecks = subchecks->next;
|
||||
}
|
||||
|
||||
result = sanitize_output_insitu(result);
|
||||
|
||||
if (pd_string != NULL && strlen(pd_string) > 0) {
|
||||
asprintf(&result, "%s|%s", result, pd_string);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue