0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-02-22 23:57:09 +00:00
termux-packages/x11-packages/luanti/0003-prepend-termux-prefix-to-tmp-path.patch
2025-02-15 12:19:10 +08:00

31 lines
1007 B
Diff

Fixes "An error occurred: Failed to download 'Minetest Game'"
when trying to download any gamemode through the builtin browser,
as described here: https://github.com/termux-user-repository/tur/issues/1325
Lua portion adapted from https://github.com/termux/termux-packages/blob/master/packages/liblua52/lua-5.2.4_src_loslib.c.patch
--- a/lib/lua/src/luaconf.h
+++ b/lib/lua/src/luaconf.h
@@ -653,9 +653,9 @@ union luai_Cast { double l_d; long l_l; };
#if defined(LUA_USE_MKSTEMP)
#include <unistd.h>
-#define LUA_TMPNAMBUFSIZE 32
+#define LUA_TMPNAMBUFSIZE 512
#define lua_tmpnam(b,e) { \
- strcpy(b, "/tmp/lua_XXXXXX"); \
+ strcpy(b, "@TERMUX_PREFIX@/tmp/lua_XXXXXX"); \
e = mkstemp(b); \
if (e != -1) close(e); \
e = (e == -1); }
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -439,7 +439,7 @@ std::string TempPath()
#ifdef DISABLING_THIS_BECAUSE_IT_IS_FOR_BUILDING_AN_APK
return porting::path_cache;
#else
- return DIR_DELIM "tmp";
+ return "@TERMUX_PREFIX@" DIR_DELIM "tmp";
#endif
}