Fix nixio exece()
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 29 Oct 2012 12:52:27 +0000 (12:52 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 29 Oct 2012 12:52:27 +0000 (12:52 +0000)
commit06901331f5c8a0cfdb19520e1feed90fd4415b32
tree338de77d5160e123ce5501e6a61ae4ecf1b92292
parent74d93e3139d75177d5e611841b3fcc2794dbacf9
Fix nixio exece()

I had occasion to use nixio.exece() recently and I could not figure out what it
wanted for the third argument (the environment) as no matter what sort of table
I passed, even nixio.getenv(), would fail with bad argument #3 to 'exece'
(invalid environment).

What it should expect is a table full of string values for keys and something
that can be converted to a string as a value, however it inverts the value of
lua_type() and compares it against a type, which will never evaluate to true.

Getting past this, the code inserts the KEY=VALUE string before the arg userdata,
and then forgets to take the env userdata into account when collecting the
arguments back into a C char**. This patch addresses all these issues and
provides a working nixio.exece().

[Fixes #500]
libs/nixio/src/process.c