From 2a3c9c182ca02eba3f6b9eadd79b295b0c0d8d53 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 17 Jan 2019 10:09:07 +0000 Subject: [PATCH] fixed a bug in sys::openlog() --- qse/lib/awk/mod-sys.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/qse/lib/awk/mod-sys.c b/qse/lib/awk/mod-sys.c index dd8656f0..36a0dea2 100644 --- a/qse/lib/awk/mod-sys.c +++ b/qse/lib/awk/mod-sys.c @@ -900,7 +900,17 @@ static int fnc_openlog (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) if (qse_awk_rtx_valtoint(rtx, qse_awk_rtx_getarg(rtx, 2), &fac) <= -1) goto done; #if defined(QSE_CHAR_IS_MCHAR) - openlog(ident, opt, fac); + { + qse_mchar_t* mbs; + + mbs = qse_mbsdup(ident, qse_awk_rtx_getmmgr(rtx)); + if (!mbs) goto done; + + if (mctx->log_ident) qse_awk_rtx_freemem (rtx, mctx->log_ident); + mctx->log_ident = mbs; + + openlog(mbs, opt, fac); + } #else {