Module: kamailio Branch: master Commit: 1dac6708935dafce2ff6398f98cce97ab5a56f4d URL: https://github.com/kamailio/kamailio/commit/1dac6708935dafce2ff6398f98cce97ab5a56f4d
Author: Olle E. Johansson <[email protected]> Committer: Olle E. Johansson <[email protected]> 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/1dac6708935dafce2ff6398f98cce97ab5a56f4d.diff Patch: https://github.com/kamailio/kamailio/commit/1dac6708935dafce2ff6398f98cce97ab5a56f4d.patch --- 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", _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
