Module: check_mk
Branch: master
Commit: d38333cf99c50a82ede79e73ba584d6b31e8017f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d38333cf99c50a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Oct 26 16:08:49 2012 +0200
livecheck: fix escaping of \ in nagios checkresults file
---
ChangeLog | 1 +
livestatus/src/livecheck.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4268d5b..8dcc939 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -118,6 +118,7 @@
* FIX: close inherited unused filedescriptors after fork()
* FIX: kill process group of called plugin if timeout is reached
-> preventing possible freeze of livecheck
+ * FIX: correct escaping of character / in nagios checkresult file
Checks & Agents:
* FIX: Linux mk_logwatch: iregex Parameter was never used
diff --git a/livestatus/src/livecheck.c b/livestatus/src/livecheck.c
index 9659404..461a08a 100644
--- a/livestatus/src/livecheck.c
+++ b/livestatus/src/livecheck.c
@@ -224,9 +224,14 @@ int main(int argc, char **argv)
fputs(ptr_output, checkfile);
fputs("\\n", checkfile);
ptr_output = ptr_walk + 1;
- if (*ptr_output == 0)
- break;
+ } else if (*ptr_walk == '\\') {
+ *ptr_walk = 0;
+ fputs(ptr_output, checkfile);
+ fputs("\\\\", checkfile);
+ ptr_output = ptr_walk + 1;
}
+ if (*ptr_output == 0)
+ break;
ptr_walk++;
}
fputs("\n", checkfile);