On 17-03 12:29, Henning Westerholt wrote:
On Tuesday 17 March 2009, Jan Janak wrote:
thank you
for the patches, i've commited them to master. The only
remaining error (after /lib/kcore/km_crc was merged) is some
incompatiblity with the LM_GEN1 macro from dprint.h.
Henning,
any preferences on how to fix this? Carrierroute module in the sip-router
master branch currently does not compile.
Hi Jan,
cr seems to be the only module that use LM_GEN1 with variable argument list,
so probably it make sense to fix it in the module. Patch attached, as my sr
tree behaves strange at the moment. It shows dozens of files as new, which i
don't modified.
Cheers,
Henning
diff --git a/modules/carrierroute/cr_config.c
b/modules/carrierroute/cr_config.c
index 48975a5..f8e587e 100644
--- a/modules/carrierroute/cr_config.c
+++ b/modules/carrierroute/cr_config.c
@@ -50,8 +50,15 @@
* @param ap format arguments
*/
static void conf_error(cfg_t *cfg, const char * fmt, va_list ap) {
- // FIXME this don't seems to work reliable, produces strange error messages
- LM_GEN1(L_ERR, (char *) fmt, ap);
+ char buf[1024];
+
+ if (vsnprintf(buf, sizeof(buf), fmt, ap) < 0) {
+ LM_ERR("could not print error message\n");
+ } else {
+ // FIXME this don't seems to work reliable in all cases, charset problems
+ LM_GEN1(L_ERR, "%s", buf);
+ }
+ va_end(ap);
The function which calls the error handler in libconfuse already calls va_end
when the handler finishes, so either you should call va_start at the beginning
of this function or you should remove va_end from this function. See confuse.c,
search for cfg_error function.
Jan.