Remove use of clearenv(), it is not portable
This commit is contained in:
parent
c739534c38
commit
1506c1e49a
1 changed files with 5 additions and 2 deletions
|
@ -18,6 +18,8 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern char **environ;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Returns the value of the given environment
|
* Returns the value of the given environment
|
||||||
* variable.
|
* variable.
|
||||||
|
@ -72,7 +74,8 @@ environment_set(lua_State *L)
|
||||||
|
|
||||||
variable = luaL_checkstring(L, 1);
|
variable = luaL_checkstring(L, 1);
|
||||||
value = luaL_checkstring(L, 2);
|
value = luaL_checkstring(L, 2);
|
||||||
ret = setenv(variable, value, 1);
|
|
||||||
|
ret = setenv(variable, value, 1);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -110,7 +113,7 @@ environment_clear(lua_State *L)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (lua_isnoneornil(L, 1)) {
|
if (lua_isnoneornil(L, 1)) {
|
||||||
clearenv();
|
environ = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue