monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit-dev] [monit] r237 committed - fix #31008: monit adds wrong newlin


From: monit
Subject: [monit-dev] [monit] r237 committed - fix #31008: monit adds wrong newlines to email headers causing broken ...
Date: Fri, 10 Sep 2010 14:11:21 +0000

Revision: 237
Author: martin2812
Date: Fri Sep 10 07:09:15 2010
Log: fix #31008: monit adds wrong newlines to email headers causing broken mails
http://code.google.com/p/monit/source/detail?r=237

Modified:
 /trunk/CHANGES.txt
 /trunk/validate.c

=======================================
--- /trunk/CHANGES.txt  Mon Sep  6 05:48:55 2010
+++ /trunk/CHANGES.txt  Fri Sep 10 07:09:15 2010
@@ -108,6 +108,10 @@
with string "system_" so conflict with existing service is less likely. Thanks to
   Thorsten Kampe for report and help.

+* Remove extra NL characters from message when resource succeeded event is sent. + The extra NL character may break the mail headers. Thanks to Hanno Boeck for
+  report and patch.
+


 Version 5.1.1
=======================================
--- /trunk/validate.c   Mon Sep  6 05:48:55 2010
+++ /trunk/validate.c   Fri Sep 10 07:09:15 2010
@@ -681,7 +681,7 @@
snprintf(report, STRLEN, "cpu usage of %.1f%% matches resource limit [cpu usage%s%.1f%%]", s->inf->cpu_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' cpu usage check succeeded [current cpu usage=%.1f%%]\n", s->name, s->inf->cpu_percent/10.0); + snprintf(report, STRLEN, "'%s' cpu usage check succeeded [current cpu usage=%.1f%%]", s->name, s->inf->cpu_percent/10.0);
     break;

   case RESOURCE_ID_TOTAL_CPU_PERCENT:
@@ -691,7 +691,7 @@
snprintf(report, STRLEN, "total cpu usage of %.1f%% matches resource limit [cpu usage%s%.1f%%]", s->inf->total_cpu_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' total cpu usage check succeeded [current cpu usage=%.1f%%]\n", s->name, s->inf->total_cpu_percent/10.0); + snprintf(report, STRLEN, "'%s' total cpu usage check succeeded [current cpu usage=%.1f%%]", s->name, s->inf->total_cpu_percent/10.0);
     break;

   case RESOURCE_ID_CPUUSER:
@@ -699,7 +699,7 @@
snprintf(report, STRLEN, "cpu user usage of %.1f%% matches resource limit [cpu user usage%s%.1f%%]", systeminfo.total_cpu_user_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' cpu user usage check succeeded [current cpu user usage=%.1f%%]\n", s->name, systeminfo.total_cpu_user_percent/10.0); + snprintf(report, STRLEN, "'%s' cpu user usage check succeeded [current cpu user usage=%.1f%%]", s->name, systeminfo.total_cpu_user_percent/10.0);
     break;

   case RESOURCE_ID_CPUSYSTEM:
@@ -707,7 +707,7 @@
snprintf(report, STRLEN, "cpu system usage of %.1f%% matches resource limit [cpu system usage%s%.1f%%]", systeminfo.total_cpu_syst_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' cpu system usage check succeeded [current cpu system usage=%.1f%%]\n", s->name, systeminfo.total_cpu_syst_percent/10.0); + snprintf(report, STRLEN, "'%s' cpu system usage check succeeded [current cpu system usage=%.1f%%]", s->name, systeminfo.total_cpu_syst_percent/10.0);
     break;

   case RESOURCE_ID_CPUWAIT:
@@ -715,7 +715,7 @@
snprintf(report, STRLEN, "cpu wait usage of %.1f%% matches resource limit [cpu wait usage%s%.1f%%]", systeminfo.total_cpu_wait_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' cpu wait usage check succeeded [current cpu wait usage=%.1f%%]\n", s->name, systeminfo.total_cpu_wait_percent/10.0); + snprintf(report, STRLEN, "'%s' cpu wait usage check succeeded [current cpu wait usage=%.1f%%]", s->name, systeminfo.total_cpu_wait_percent/10.0);
     break;

   case RESOURCE_ID_MEM_PERCENT:
@@ -724,13 +724,13 @@
snprintf(report, STRLEN, "mem usage of %.1f%% matches resource limit [mem usage%s%.1f%%]", systeminfo.total_mem_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' mem usage check succeeded [current mem usage=%.1f%%]\n", s->name, systeminfo.total_mem_percent/10.0); + snprintf(report, STRLEN, "'%s' mem usage check succeeded [current mem usage=%.1f%%]", s->name, systeminfo.total_mem_percent/10.0);
     } else {
if (Util_evalQExpression(r->operator, s->inf->mem_percent, r->limit)) { snprintf(report, STRLEN, "mem usage of %.1f%% matches resource limit [mem usage%s%.1f%%]", s->inf->mem_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' mem usage check succeeded [current mem usage=%.1f%%]\n", s->name, s->inf->mem_percent/10.0); + snprintf(report, STRLEN, "'%s' mem usage check succeeded [current mem usage=%.1f%%]", s->name, s->inf->mem_percent/10.0);
     }
     break;

@@ -740,13 +740,13 @@
snprintf(report, STRLEN, "mem amount of %ldkB matches resource limit [mem amount%s%ldkB]", systeminfo.total_mem_kbyte, operatorshortnames[r->operator], r->limit);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' mem amount check succeeded [current mem amount=%ldkB]\n", s->name, systeminfo.total_mem_kbyte); + snprintf(report, STRLEN, "'%s' mem amount check succeeded [current mem amount=%ldkB]", s->name, systeminfo.total_mem_kbyte);
     } else {
       if (Util_evalQExpression(r->operator, s->inf->mem_kbyte, r->limit)) {
snprintf(report, STRLEN, "mem amount of %ldkB matches resource limit [mem amount%s%ldkB]", s->inf->mem_kbyte, operatorshortnames[r->operator], r->limit);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' mem amount check succeeded [current mem amount=%ldkB]\n", s->name, s->inf->mem_kbyte); + snprintf(report, STRLEN, "'%s' mem amount check succeeded [current mem amount=%ldkB]", s->name, s->inf->mem_kbyte);
     }
     break;

@@ -756,7 +756,7 @@
snprintf(report, STRLEN, "swap usage of %.1f%% matches resource limit [swap usage%s%.1f%%]", systeminfo.total_swap_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' swap usage check succeeded [current swap usage=%.1f%%]\n", s->name, systeminfo.total_swap_percent/10.0); + snprintf(report, STRLEN, "'%s' swap usage check succeeded [current swap usage=%.1f%%]", s->name, systeminfo.total_swap_percent/10.0);
     }
     break;

@@ -766,7 +766,7 @@
snprintf(report, STRLEN, "swap amount of %ldkB matches resource limit [swap amount%s%ldkB]", systeminfo.total_swap_kbyte, operatorshortnames[r->operator], r->limit);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' swap amount check succeeded [current swap amount=%ldkB]\n", s->name, systeminfo.total_swap_kbyte); + snprintf(report, STRLEN, "'%s' swap amount check succeeded [current swap amount=%ldkB]", s->name, systeminfo.total_swap_kbyte);
     }
     break;

@@ -775,7 +775,7 @@
snprintf(report, STRLEN, "loadavg(1min) of %.1f matches resource limit " "[loadavg(1min)%s%.1f]", systeminfo.loadavg[0], operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' loadavg(1min) check succeeded [current loadavg(1min)=%.1f]\n", s->name, systeminfo.loadavg[0]); + snprintf(report, STRLEN, "'%s' loadavg(1min) check succeeded [current loadavg(1min)=%.1f]", s->name, systeminfo.loadavg[0]);
     break;

   case RESOURCE_ID_LOAD5:
@@ -783,7 +783,7 @@
snprintf(report, STRLEN, "loadavg(5min) of %.1f matches resource limit " "[loadavg(5min)%s%.1f]", systeminfo.loadavg[1], operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' loadavg(5min) check succeeded [current loadavg(5min)=%.1f]\n", s->name, systeminfo.loadavg[1]); + snprintf(report, STRLEN, "'%s' loadavg(5min) check succeeded [current loadavg(5min)=%.1f]", s->name, systeminfo.loadavg[1]);
     break;

   case RESOURCE_ID_LOAD15:
@@ -791,7 +791,7 @@
snprintf(report, STRLEN, "loadavg(15min) of %.1f matches resource limit " "[loadavg(15min)%s%.1f]", systeminfo.loadavg[2], operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' loadavg(15min) check succeeded [current loadavg(15min)=%.1f]\n", s->name, systeminfo.loadavg[2]); + snprintf(report, STRLEN, "'%s' loadavg(15min) check succeeded [current loadavg(15min)=%.1f]", s->name, systeminfo.loadavg[2]);
     break;

   case RESOURCE_ID_CHILDREN:
@@ -799,7 +799,7 @@
snprintf(report, STRLEN, "children of %i matches resource limit [children%s%ld]", s->inf->children, operatorshortnames[r->operator], r->limit);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' children check succeeded [current children=%i]\n", s->name, s->inf->children); + snprintf(report, STRLEN, "'%s' children check succeeded [current children=%i]", s->name, s->inf->children);
     break;

   case RESOURCE_ID_TOTAL_MEM_KBYTE:
@@ -807,7 +807,7 @@
snprintf(report, STRLEN, "total mem amount of %ldkB matches resource limit" " [total mem amount%s%ldkB]", s->inf->total_mem_kbyte, operatorshortnames[r->operator], r->limit);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' total mem amount check succeeded " "[current total mem amount=%ldkB]\n", s->name, s->inf->total_mem_kbyte); + snprintf(report, STRLEN, "'%s' total mem amount check succeeded " "[current total mem amount=%ldkB]", s->name, s->inf->total_mem_kbyte);
     break;

   case RESOURCE_ID_TOTAL_MEM_PERCENT:
@@ -815,7 +815,7 @@
snprintf(report, STRLEN, "total mem amount of %.1f%% matches resource limit" " [total mem amount%s%.1f%%]", (float)s->inf->total_mem_percent/10.0, operatorshortnames[r->operator], (float)r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' total mem amount check succeeded " "[current total mem amount=%.1f%%]\n", s->name, s->inf->total_mem_percent/10.0); + snprintf(report, STRLEN, "'%s' total mem amount check succeeded " "[current total mem amount=%.1f%%]", s->name, s->inf->total_mem_percent/10.0);
     break;

   default:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]