From: Arnaud Giersch Date: Wed, 30 Aug 2017 12:41:47 +0000 (+0200) Subject: Don't mess ev->ap (allows multiple %m in layout). X-Git-Tag: v3_17~184 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8d387cbb31720448e982bcde84a1ba1e51830470 Don't mess ev->ap (allows multiple %m in layout). --- diff --git a/src/xbt/xbt_log_layout_format.c b/src/xbt/xbt_log_layout_format.c index 18c55ac2ce..7c41b5b706 100644 --- a/src/xbt/xbt_log_layout_format.c +++ b/src/xbt/xbt_log_layout_format.c @@ -153,7 +153,10 @@ static int xbt_log_layout_format_doit(xbt_log_layout_t l, xbt_log_event_t ev, co case 'm': { /* user-provided message; LOG4J compliant */ int sz; set_sz_from_precision(); - int len = vsnprintf(p, sz, msg_fmt, ev->ap); + va_list ap; + va_copy(ap, ev->ap); + int len = vsnprintf(p, sz, msg_fmt, ap); + va_end(ap); check_overflow(MIN(sz, len)); break; }