diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-07-09 13:19:46 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-07-09 13:19:46 +0000 |
commit | 2db3e832883b212925d0599d113a1a1000d0bb7e (patch) | |
tree | 4a6d053c29dc7092151b37f3a577f210dae6abfe /Build/source/texk/web2c/luatexdir/lua | |
parent | b98940bc6a3d63959c1e0c07acf5c09626bf9efa (diff) |
luaTeX: Use binary file io mode (from W32TeX)
Sync shell_cmd_is_allowed() and runpopen() with ../lib/texmfmp.c
git-svn-id: svn://tug.org/texlive/trunk@26978 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/liolib.c | 14 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/loslibext.c | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/liolib.c b/Build/source/texk/web2c/luatexdir/lua/liolib.c index a85b38b8683..b742928c6bd 100644 --- a/Build/source/texk/web2c/luatexdir/lua/liolib.c +++ b/Build/source/texk/web2c/luatexdir/lua/liolib.c @@ -162,7 +162,7 @@ static int io_tostring(lua_State * L) static int io_open(lua_State * L) { const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); + const char *mode = luaL_optstring(L, 2, "rb"); FILE **pf = newfile(L); *pf = fopen(filename, mode); if (*pf == NULL) @@ -178,7 +178,7 @@ static int io_open_ro(lua_State * L) { FILE **pf; const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); + const char *mode = luaL_optstring(L, 2, "rb"); if ((strcmp(mode, "r") != 0) && (strcmp(mode, "rb") != 0)) return pushresult(L, 0, filename); pf = newfile(L); @@ -200,7 +200,7 @@ static int io_popen(lua_State * L) char *cmdname = NULL; int allow = 0; const char *cmd = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); + const char *mode = luaL_optstring(L, 2, "rb"); FILE **pf = newfile(L); if (shellenabledp <= 0) { @@ -212,7 +212,7 @@ static int io_popen(lua_State * L) if (restrictedshell == 0) allow = 1; else - allow = shell_cmd_is_allowed(&cmd, &safecmd, &cmdname); + allow = shell_cmd_is_allowed(cmd, &safecmd, &cmdname); if (allow == 1) { *pf = lua_popen(L, cmd, mode); @@ -281,13 +281,13 @@ static int g_iofile(lua_State * L, int f, const char *mode) static int io_input(lua_State * L) { - return g_iofile(L, IO_INPUT, "r"); + return g_iofile(L, IO_INPUT, "rb"); } static int io_output(lua_State * L) { - return g_iofile(L, IO_OUTPUT, "w"); + return g_iofile(L, IO_OUTPUT, "wb"); } @@ -319,7 +319,7 @@ static int io_lines(lua_State * L) } else { const char *filename = luaL_checkstring(L, 1); FILE **pf = newfile(L); - *pf = fopen(filename, "r"); + *pf = fopen(filename, "rb"); if (*pf == NULL) fileerror(L, 1, filename); else diff --git a/Build/source/texk/web2c/luatexdir/lua/loslibext.c b/Build/source/texk/web2c/luatexdir/lua/loslibext.c index 8888d08a7cf..5bc46fca400 100644 --- a/Build/source/texk/web2c/luatexdir/lua/loslibext.c +++ b/Build/source/texk/web2c/luatexdir/lua/loslibext.c @@ -463,7 +463,7 @@ static int os_exec(lua_State * L) allow = 1; } else { const char *theruncmd = runcmd; - allow = shell_cmd_is_allowed(&theruncmd, &safecmd, &cmdname); + allow = shell_cmd_is_allowed(theruncmd, &safecmd, &cmdname); } if (allow > 0 && cmdline != NULL && runcmd != NULL) { @@ -545,7 +545,7 @@ static int os_spawn(lua_State * L) allow = 1; } else { const char *theruncmd = runcmd; - allow = shell_cmd_is_allowed(&theruncmd, &safecmd, &cmdname); + allow = shell_cmd_is_allowed(theruncmd, &safecmd, &cmdname); } if (allow > 0 && cmdline != NULL && runcmd != NULL) { if (allow == 2) @@ -993,7 +993,7 @@ static int os_execute(lua_State * L) if (restrictedshell == 0) allow = 1; else - allow = shell_cmd_is_allowed(&cmd, &safecmd, &cmdname); + allow = shell_cmd_is_allowed(cmd, &safecmd, &cmdname); if (allow == 1) { lua_pushinteger(L, system(cmd)); |