diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2026-03-16 12:28:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-16 12:28:25 +0100 |
| commit | 2d4f98f50b3470852aea99c61c64cfc11405a8fc (patch) | |
| tree | 20b125d44d38055afca31b31cce2cf67887edb89 /lib | |
| parent | a9e23d05a6c0180b76cc5dc796c8892aaa5ddd3e (diff) | |
| download | monitoring-plugins-2d4f98f50b3470852aea99c61c64cfc11405a8fc.tar.gz | |
Co-authored-by: Lorenz Kästle <lorenz.kaestle@netways.de>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/output.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/output.c b/lib/output.c index d1a8d3b9..bfd43195 100644 --- a/lib/output.c +++ b/lib/output.c | |||
| @@ -259,6 +259,21 @@ mp_state_enum mp_eval_check_default(const mp_check check) { | |||
| 259 | return result; | 259 | return result; |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | // Remove troublesome symbols from plugin output | ||
| 263 | char *sanitize_output_insitu(char *input) { | ||
| 264 | if (input == NULL) { | ||
| 265 | return input; | ||
| 266 | } | ||
| 267 | |||
| 268 | for (char *walker = input; *walker != '\0'; walker++) { | ||
| 269 | if (*walker == '|') { | ||
| 270 | *walker = ' '; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | return input; | ||
| 275 | } | ||
| 276 | |||
| 262 | /* | 277 | /* |
| 263 | * Generate output string for a mp_check object | 278 | * Generate output string for a mp_check object |
| 264 | * Non static to be available for testing functions | 279 | * Non static to be available for testing functions |
| @@ -299,6 +314,8 @@ char *mp_fmt_output(mp_check check) { | |||
| 299 | subchecks = subchecks->next; | 314 | subchecks = subchecks->next; |
| 300 | } | 315 | } |
| 301 | 316 | ||
| 317 | result = sanitize_output_insitu(result); | ||
| 318 | |||
| 302 | if (pd_string != NULL && strlen(pd_string) > 0) { | 319 | if (pd_string != NULL && strlen(pd_string) > 0) { |
| 303 | asprintf(&result, "%s|%s", result, pd_string); | 320 | asprintf(&result, "%s|%s", result, pd_string); |
| 304 | } | 321 | } |
