diff options
author | Rob Kendrick <rjek@humdrum> | 2012-03-07 09:13:25 +0000 |
---|---|---|
committer | Rob Kendrick <rjek@humdrum> | 2012-03-07 09:13:25 +0000 |
commit | 79ca8bddb85f6f6147ad65100fcf653ffb78dbcc (patch) | |
tree | 4ee4573dad819c494160469248b5138af03f446e /luxio.c | |
parent | 648cc1fab015717a459d270a52f7efc936625f3a (diff) | |
download | luxio-79ca8bddb85f6f6147ad65100fcf653ffb78dbcc.tar.gz |
Remove C99ism from exec
Diffstat (limited to 'luxio.c')
-rw-r--r-- | luxio.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |