|
@@ -1,8 +1,8 @@
|
|
-Only in src-amzn\: LICENSE
|
|
|
|
-diff -ru src\/loadlib.c src-amzn\/loadlib.c
|
|
|
|
---- src\/loadlib.c 2017-04-19 10:20:42.000000000 -0700
|
|
|
|
-+++ src-amzn\/loadlib.c 2021-04-16 14:18:21.187929700 -0700
|
|
|
|
-@@ -184,12 +184,14 @@
|
|
|
|
|
|
+diff --git a/loadlib.c b/loadlib.c
|
|
|
|
+index 6f9fa373..e50fbcb8 100644
|
|
|
|
+--- a/loadlib.c
|
|
|
|
++++ b/loadlib.c
|
|
|
|
+@@ -193,11 +193,13 @@ static void setprogdir (lua_State *L) {
|
|
|
|
|
|
static void pusherror (lua_State *L) {
|
|
static void pusherror (lua_State *L) {
|
|
int error = GetLastError();
|
|
int error = GetLastError();
|
|
@@ -12,45 +12,45 @@ diff -ru src\/loadlib.c src-amzn\/loadlib.c
|
|
NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL))
|
|
NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL))
|
|
lua_pushstring(L, buffer);
|
|
lua_pushstring(L, buffer);
|
|
else
|
|
else
|
|
-- lua_pushfstring(L, "system error %d\n", error);
|
|
|
|
+#endif
|
|
+#endif
|
|
-+ lua_pushfstring(L, "system error %d\n", error);
|
|
|
|
|
|
+ lua_pushfstring(L, "system error %d\n", error);
|
|
}
|
|
}
|
|
|
|
|
|
- static void lsys_unloadlib (void *lib) {
|
|
|
|
-diff -ru src\/loslib.c src-amzn\/loslib.c
|
|
|
|
---- src\/loslib.c 2017-04-19 10:29:57.000000000 -0700
|
|
|
|
-+++ src-amzn\/loslib.c 2021-04-16 15:43:26.939098900 -0700
|
|
|
|
-@@ -21,6 +21,10 @@
|
|
|
|
|
|
+diff --git a/loslib.c b/loslib.c
|
|
|
|
+index 3e20d622..cbca1c5a 100644
|
|
|
|
+--- a/loslib.c
|
|
|
|
++++ b/loslib.c
|
|
|
|
+@@ -21,6 +21,9 @@
|
|
#include "lauxlib.h"
|
|
#include "lauxlib.h"
|
|
#include "lualib.h"
|
|
#include "lualib.h"
|
|
|
|
|
|
+#if defined(__APPLE__)
|
|
+#if defined(__APPLE__)
|
|
+#include <TargetConditionals.h>
|
|
+#include <TargetConditionals.h>
|
|
+#endif
|
|
+#endif
|
|
-+
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
** {==================================================================
|
|
** {==================================================================
|
|
-@@ -139,8 +143,13 @@
|
|
|
|
|
|
+@@ -140,10 +143,15 @@
|
|
|
|
|
|
|
|
|
|
static int os_execute (lua_State *L) {
|
|
static int os_execute (lua_State *L) {
|
|
-+#if defined(TARGET_OS_IPHONE)
|
|
|
|
|
|
++ #if defined(TARGET_OS_IPHONE)
|
|
+ const char* cmd = NULL;
|
|
+ const char* cmd = NULL;
|
|
+ int stat = -1;
|
|
+ int stat = -1;
|
|
+#else
|
|
+#else
|
|
const char *cmd = luaL_optstring(L, 1, NULL);
|
|
const char *cmd = luaL_optstring(L, 1, NULL);
|
|
- int stat = system(cmd);
|
|
|
|
|
|
+ int stat;
|
|
|
|
+ errno = 0;
|
|
|
|
+ stat = system(cmd);
|
|
+#endif
|
|
+#endif
|
|
if (cmd != NULL)
|
|
if (cmd != NULL)
|
|
return luaL_execresult(L, stat);
|
|
return luaL_execresult(L, stat);
|
|
else {
|
|
else {
|
|
-@@ -157,20 +166,29 @@
|
|
|
|
|
|
+@@ -160,20 +168,29 @@ static int os_remove (lua_State *L) {
|
|
|
|
|
|
|
|
|
|
static int os_rename (lua_State *L) {
|
|
static int os_rename (lua_State *L) {
|
|
-+#if !defined(APPLE) && !defined(ANDROID)
|
|
|
|
|
|
++#if !defined(TARGET_OS_IPHONE) && !defined(ANDROID)
|
|
const char *fromname = luaL_checkstring(L, 1);
|
|
const char *fromname = luaL_checkstring(L, 1);
|
|
const char *toname = luaL_checkstring(L, 2);
|
|
const char *toname = luaL_checkstring(L, 2);
|
|
return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
|
|
return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
|
|
@@ -62,18 +62,17 @@ diff -ru src\/loslib.c src-amzn\/loslib.c
|
|
|
|
|
|
|
|
|
|
static int os_tmpname (lua_State *L) {
|
|
static int os_tmpname (lua_State *L) {
|
|
-+#if !defined(APPLE) && !defined(ANDROID)
|
|
|
|
|
|
++#if !defined(TARGET_OS_IPHONE) && !defined(ANDROID)
|
|
char buff[LUA_TMPNAMBUFSIZE];
|
|
char buff[LUA_TMPNAMBUFSIZE];
|
|
int err;
|
|
int err;
|
|
lua_tmpnam(buff, err);
|
|
lua_tmpnam(buff, err);
|
|
- if (err)
|
|
|
|
|
|
+ if (l_unlikely(err))
|
|
+#endif
|
|
+#endif
|
|
return luaL_error(L, "unable to generate a unique filename");
|
|
return luaL_error(L, "unable to generate a unique filename");
|
|
-+#if !defined(APPLE) && !defined(ANDROID)
|
|
|
|
|
|
++#if !defined(TARGET_OS_IPHONE) && !defined(ANDROID)
|
|
lua_pushstring(L, buff);
|
|
lua_pushstring(L, buff);
|
|
return 1;
|
|
return 1;
|
|
+#endif
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-Only in src\: Makefile
|
|
|