summaryrefslogtreecommitdiff
path: root/luxio.c
diff options
context:
space:
mode:
authorRob Kendrick <rjek@humdrum>2012-03-07 09:13:25 +0000
committerRob Kendrick <rjek@humdrum>2012-03-07 09:13:25 +0000
commit79ca8bddb85f6f6147ad65100fcf653ffb78dbcc (patch)
tree4ee4573dad819c494160469248b5138af03f446e /luxio.c
parent648cc1fab015717a459d270a52f7efc936625f3a (diff)
downloadluxio-79ca8bddb85f6f6147ad65100fcf653ffb78dbcc.tar.gz
Remove C99ism from exec
Diffstat (limited to 'luxio.c')
-rw-r--r--luxio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/luxio.c b/luxio.c
index 96a3344..b66ed8d 100644
--- a/luxio.c
+++ b/luxio.c
@@ -1231,12 +1231,14 @@ luxio_exec(lua_State *L)
{
const char *path = luaL_checkstring(L, 1);
int params = lua_gettop(L) - 1;
- char *args[params + 1];
+ char **args;
int c, ret;
/* we probably at least need them to fill in arg[0] ... */
luaL_checkstring(L, 2);
+ args = calloc(params + 1, sizeof(*args));
+
for (c = 0; c < params; c++) {
/* gah! constness */
args[c] = (char *)luaL_checkstring(L, c + 2);
@@ -1246,6 +1248,7 @@ luxio_exec(lua_State *L)
ret = execv(path, args);
/* if we got here, there's an error. */
+ free(args);
lua_pushinteger(L, ret);
lua_pushinteger(L, errno);
return 2;