Module: kamailio
Branch: master
Commit: 1dac6708935dafce2ff6398f98cce97ab5a56f4d
URL:
https://github.com/kamailio/kamailio/commit/1dac6708935dafce2ff6398f98cce97…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: 2015-02-04T18:27:14+01:00
pipelimit Only output error five times
---
Modified: modules/pipelimit/pipelimit.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1dac6708935dafce2ff6398f98cce97…
Patch:
https://github.com/kamailio/kamailio/commit/1dac6708935dafce2ff6398f98cce97…
---
diff --git a/modules/pipelimit/pipelimit.c b/modules/pipelimit/pipelimit.c
index 861d6b1..5ed5c13 100644
--- a/modules/pipelimit/pipelimit.c
+++ b/modules/pipelimit/pipelimit.c
@@ -223,9 +223,15 @@ static int get_cpuload(double * load)
FILE * f = fopen("/proc/stat", "r");
double vload;
int ncpu;
+ static int errormsg = 0;
if (! f) {
- LM_ERR("could not open /proc/stat\n");
+ /* Only write this error message five times. Otherwise you will annoy
+ BSD-ish system administrators. */
+ if (errormsg < 5) {
+ LM_ERR("could not open /proc/stat\n");
+ errormsg++;
+ }
return -1;
}
if (fscanf(f, "cpu %lld%lld%lld%lld%lld%lld%lld%lld",