summaryrefslogtreecommitdiff
path: root/luaext
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2019-03-01 14:56:31 +0200
committerPanu Matilainen <pmatilai@redhat.com>2019-03-01 14:56:31 +0200
commite7b80af13691db08127d89285a7713667bae1f26 (patch)
treee5f51683622cb86ab87cc6bacdefd21304518220 /luaext
parent508a492c35406cdb9f83adebf2f65a2004779b25 (diff)
downloadrpm-e7b80af13691db08127d89285a7713667bae1f26.tar.gz
Move redirect2null() out of posix extensions but preserve compatibility
posix.redirect2null() is a decidedly rpm-specific, it should've really always been rpm.redirect2null(). Move the code to rpmlua.c and make it available in the rpm-namespace, but to preserve script compatibility add it to the posix module too. One step closer to unforking the posix extensions which is more or less a pre-requisite for ticket #165.
Diffstat (limited to 'luaext')
-rw-r--r--luaext/lposix.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/luaext/lposix.c b/luaext/lposix.c
index f15b511a9..a3f4852cf 100644
--- a/luaext/lposix.c
+++ b/luaext/lposix.c
@@ -823,25 +823,6 @@ static int Pmkstemp(lua_State *L)
return 2;
}
-static int Predirect2null(lua_State *L)
-{
- int target_fd, fd, r, e;
-
- if (!_rpmlua_have_forked)
- return luaL_error(L, "redirect2null not permitted in this context");
-
- target_fd = luaL_checkinteger(L, 1);
-
- r = fd = open("/dev/null", O_WRONLY);
- if (fd >= 0 && fd != target_fd) {
- r = dup2(fd, target_fd);
- e = errno;
- (void) close(fd);
- errno = e;
- }
- return pushresult(L, r, NULL);
-}
-
static const luaL_Reg R[] =
{
{"access", Paccess},
@@ -884,7 +865,6 @@ static const luaL_Reg R[] =
{"wait", Pwait},
{"setenv", Psetenv},
{"unsetenv", Punsetenv},
- {"redirect2null", Predirect2null},
{NULL, NULL}
};