summaryrefslogtreecommitdiff
path: root/luaext
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-01-04 14:15:20 +0200
committerPanu Matilainen <pmatilai@redhat.com>2010-01-04 14:15:20 +0200
commit580f9625e166be7771ead94f500e54a5b34d3196 (patch)
tree3b36e18c8119821e71489aad98946afc265f3e41 /luaext
parent60dc809db136e8bba12a9d45e189248218e304cb (diff)
downloadlibrpm-tizen-580f9625e166be7771ead94f500e54a5b34d3196.tar.gz
librpm-tizen-580f9625e166be7771ead94f500e54a5b34d3196.tar.bz2
librpm-tizen-580f9625e166be7771ead94f500e54a5b34d3196.zip
Remove largely unnecessary putenv() replacement
- only the lua posix extension "uses" this by providing putenv() to Lua, make it conditional and return error if not supported by the underlying operating system
Diffstat (limited to 'luaext')
-rw-r--r--luaext/lposix.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/luaext/lposix.c b/luaext/lposix.c
index ae407a1e2..5b26e0c8f 100644
--- a/luaext/lposix.c
+++ b/luaext/lposix.c
@@ -5,6 +5,10 @@
* 05 Nov 2003 22:09:10
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -360,10 +364,14 @@ static int Psleep(lua_State *L) /** sleep(seconds) */
static int Pputenv(lua_State *L) /** putenv(string) */
{
+#if HAVE_PUTENV
size_t l;
const char *s=luaL_checklstring(L, 1, &l);
char *e=malloc(++l);
return pushresult(L, (e==NULL) ? -1 : putenv(memcpy(e,s,l)), s);
+#else
+ return -1;
+#endif
}