warning: the use of `tmpnam' is dangerous, better use `mkstemp'
BarbzYHOOL opened this issue · comments
../../../modules/mod-eluna-lua-engine/lualib/liblualib.a(loslib.c.o): In function `os_tmpname':
loslib.c:(.text+0x86c): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
???
#if defined(LUA_USE_MKSTEMP)
#include <unistd.h>
#define LUA_TMPNAMBUFSIZE 32
#define lua_tmpnam(b,e) { \
strcpy(b, "/tmp/lua_XXXXXX"); \
e = mkstemp(b); \
if (e != -1) close(e); \
e = (e == -1); }
#elif !defined(lua_tmpnam)
#define LUA_TMPNAMBUFSIZE L_tmpnam
#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
#endif
we can drop this defines and this part of code
#define LUA_TMPNAMBUFSIZE L_tmpnam
#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
to remove warning, or pass LUA_USE_MKSTEMP to lualib
us i understand in quick view its must be done here https://github.com/azerothcore/mod-eluna-lua-engine/blob/master/cmake/after_load_cmake_modules.cmake#L6
Can define use linux and mac instead.
mod-eluna-lua-engine/lualib/luaconf.h
Lines 43 to 59 in 93dd4b5
i'd just copy that code rochet ? if so i'll try when i think about it
@BarbzYHOOL no you just pass -DLUA_USE_LINUX for Eluna( https://github.com/azerothcore/mod-eluna-lua-engine/blob/master/cmake/after_load_cmake_modules.cmake#L6 ) and then when you build you get -DLUA_USE_LINUX(whats include) LUA_USE_POSIX whats include LUA_USE_MKSTEMP whats define usage mkstemp
oh ok, thank you, when i try i'll update the readme then
it was really not clear what to do, I tried to put the variables directly in the command, ofc didn't work
so I added add_definitions(-DLUA_USE_LINUX)
here https://github.com/azerothcore/mod-eluna-lua-engine/blob/master/cmake/after_load_cmake_modules.cmake#L6 and the result is:
../../../modules/mod-eluna-lua-engine/lualib/liblualib.a(loslib.c.o): In function `os_tmpname':
loslib.c:(.text+0x86c): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
Same exact message as previously
Testing fix here: https://travis-ci.org/azerothcore/mod-eluna-lua-engine/builds/632430185?utm_source=github_status&utm_medium=notification
PS: Damn those build times are long ..