Skip to content

Commit 0bf33c1

Browse files
committed
avoid formatting issues in error messages
1 parent e8d538d commit 0bf33c1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/util.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,18 @@ void _mapcache_context_set_exception_default(mapcache_context *ctx, char *key, c
215215

216216
void _mapcache_context_set_error_default(mapcache_context *ctx, int code, char *msg, ...)
217217
{
218-
char *fmt;
218+
char *new_msg;
219219
va_list args;
220220
va_start(args,msg);
221+
new_msg = apr_pvsprintf(ctx->pool,msg,args);
222+
va_end(args);
221223

222224
if(ctx->_errmsg) {
223-
fmt=apr_psprintf(ctx->pool,"%s\n%s",ctx->_errmsg,msg);
225+
ctx->_errmsg = apr_pstrcat(ctx->pool, ctx->_errmsg, "\n", new_msg, NULL);
224226
} else {
225-
fmt=msg;
227+
ctx->_errmsg = new_msg;
226228
ctx->_errcode = code;
227229
}
228-
ctx->_errmsg = apr_pvsprintf(ctx->pool,fmt,args);
229-
va_end(args);
230230
}
231231

232232
void _mapcache_context_clear_error_default(mapcache_context *ctx)

0 commit comments

Comments
 (0)