[vlc-commits] contrib: lua: Do not use system nor popen on winrt

Hugo Beauzée-Luyssen git at videolan.org
Mon Apr 11 14:15:13 CEST 2016


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Apr 11 13:52:24 2016 +0200| [9318c15416843b09c1242813c7fcc310b9b64f5b] | committer: Hugo Beauzée-Luyssen

contrib: lua: Do not use system nor popen on winrt

Again, forbidden functions. One could argue that we don't want
os.execute on any platform though.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9318c15416843b09c1242813c7fcc310b9b64f5b
---

 contrib/src/lua/rules.mak            |    4 ++++
 contrib/src/lua/winrt-nopopen.patch  |   14 ++++++++++++++
 contrib/src/lua/winrt-nosystem.patch |   29 +++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/contrib/src/lua/rules.mak b/contrib/src/lua/rules.mak
index 17b8cef..2c08b9b 100644
--- a/contrib/src/lua/rules.mak
+++ b/contrib/src/lua/rules.mak
@@ -48,6 +48,10 @@ lua: lua-$(LUA_VERSION).tar.gz .sum-lua
 	$(APPLY) $(SRC)/lua/no-dylibs.patch
 	$(APPLY) $(SRC)/lua/no-localeconv.patch
 	$(APPLY) $(SRC)/lua/lua-android-log2.patch
+ifdef HAVE_WINRT
+	$(APPLY) $(SRC)/lua/winrt-nopopen.patch
+	$(APPLY) $(SRC)/lua/winrt-nosystem.patch
+endif
 ifdef HAVE_DARWIN_OS
 	(cd $(UNPACK_DIR) && \
 	sed -e 's%gcc%$(CC)%' \
diff --git a/contrib/src/lua/winrt-nopopen.patch b/contrib/src/lua/winrt-nopopen.patch
new file mode 100644
index 0000000..3218888
--- /dev/null
+++ b/contrib/src/lua/winrt-nopopen.patch
@@ -0,0 +1,14 @@
+--- lua/src/liolib.c.orig	2016-04-06 13:42:39.215028405 +0200
++++ lua/src/liolib.c	2016-04-06 13:48:24.006744226 +0200
+@@ -58,11 +58,6 @@
+ #define l_popen(L,c,m)		(fflush(NULL), popen(c,m))
+ #define l_pclose(L,file)	(pclose(file))
+ 
+-#elif defined(LUA_USE_WINDOWS)	/* }{ */
+-
+-#define l_popen(L,c,m)		(_popen(c,m))
+-#define l_pclose(L,file)	(_pclose(file))
+-
+ #else				/* }{ */
+ 
+ /* ISO C definitions */
diff --git a/contrib/src/lua/winrt-nosystem.patch b/contrib/src/lua/winrt-nosystem.patch
new file mode 100644
index 0000000..b08ff3a
--- /dev/null
+++ b/contrib/src/lua/winrt-nosystem.patch
@@ -0,0 +1,29 @@
+--- lua/src/loslib.c.orig	2016-04-06 14:04:30.614773245 +0200
++++ lua/src/loslib.c	2016-04-06 14:05:40.694941331 +0200
+@@ -127,18 +127,6 @@
+ 
+ 
+ 
+-static int os_execute (lua_State *L) {
+-  const char *cmd = luaL_optstring(L, 1, NULL);
+-  int stat = system(cmd);
+-  if (cmd != NULL)
+-    return luaL_execresult(L, stat);
+-  else {
+-    lua_pushboolean(L, stat);  /* true if there is a shell */
+-    return 1;
+-  }
+-}
+-
+-
+ static int os_remove (lua_State *L) {
+   const char *filename = luaL_checkstring(L, 1);
+   return luaL_fileresult(L, remove(filename) == 0, filename);
+@@ -366,7 +354,6 @@
+   {"clock",     os_clock},
+   {"date",      os_date},
+   {"difftime",  os_difftime},
+-  {"execute",   os_execute},
+   {"exit",      os_exit},
+   {"getenv",    os_getenv},
+   {"remove",    os_remove},



More information about the vlc-commits mailing list