Hi,

This fixes:
Aug 31 23:37:50 x230 luakit: *printf used %n: %s:%d%n

It can be tested:
1. start luakit
2. type: ":lua foobar()<return>"

An error text with a Traceback occurs. The text + alignment is created
with the fixed function.

OK?

Best regards,
Stefan

Index: www/luakit/Makefile
===================================================================
RCS file: /cvs/ports/www/luakit/Makefile,v
retrieving revision 1.29
diff -u -p -u -p -r1.29 Makefile
--- www/luakit/Makefile 21 Mar 2021 14:16:21 -0000      1.29
+++ www/luakit/Makefile 31 Aug 2021 21:53:30 -0000
@@ -5,6 +5,7 @@ COMMENT =       fast, small, webkit based brow
 GH_ACCOUNT =   luakit
 GH_PROJECT =   luakit
 GH_TAGNAME =   2.3
+REVISION =     0
 
 EPOCH =                1
 
Index: www/luakit/patches/patch-common_luautil_c
===================================================================
RCS file: www/luakit/patches/patch-common_luautil_c
diff -N www/luakit/patches/patch-common_luautil_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ www/luakit/patches/patch-common_luautil_c   31 Aug 2021 21:53:30 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Fix printf '%n'
+
+Index: common/luautil.c
+--- common/luautil.c.orig
++++ common/luautil.c
+@@ -72,7 +72,10 @@ luaH_traceback(lua_State *L, lua_State *T, gint min_le
+         } else {
+             const char *src = AR_SRC(ar);
+             int n;
+-            g_string_append_printf(tb, "%s:%d%n", src, ar.currentline, &n);
++            char tmp[10] = "";
++            sprintf(tmp, "%d", ar.currentline);
++            n = strlen(src) + strlen(tmp) + 1;
++            g_string_append_printf(tb, "%s:%d", src, ar.currentline);
+             g_string_append_printf(tb, "%*.*s", loc_pad-n, loc_pad-n, "");
+         }
+ 

Reply via email to