openbsd-ports/lang/lua/patches/patch-src_luaconf_h
2008-04-19 17:59:32 +00:00

31 lines
1.0 KiB
Plaintext

$OpenBSD: patch-src_luaconf_h,v 1.4 2008/04/19 17:59:32 okan Exp $
--- src/luaconf.h.orig Fri Jan 18 18:07:48 2008
+++ src/luaconf.h Mon Mar 24 13:53:08 2008
@@ -33,7 +33,7 @@
#define LUA_WIN
#endif
-#if defined(LUA_USE_LINUX)
+#if defined(LUA_USE_BSD) || defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
#define LUA_USE_READLINE /* needs some extra libraries */
@@ -520,7 +520,7 @@
*/
#define LUA_NUMBER_SCAN "%lf"
#define LUA_NUMBER_FMT "%.14g"
-#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
+#define lua_number2str(s,n) snprintf((s), sizeof((s)), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
#define lua_str2number(s,p) strtod((s), (p))
@@ -647,7 +647,7 @@ union luai_Cast { double l_d; long l_l; };
#include <unistd.h>
#define LUA_TMPNAMBUFSIZE 32
#define lua_tmpnam(b,e) { \
- strcpy(b, "/tmp/lua_XXXXXX"); \
+ strlcpy(b, "/tmp/lua_XXXXXX", sizeof(b)); \
e = mkstemp(b); \
if (e != -1) close(e); \
e = (e == -1); }