Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149637824
D50176.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
890 B
Referenced Files
None
Subscribers
None
D50176.id.diff
View Options
diff --git a/libexec/flua/modules/lposix.c b/libexec/flua/modules/lposix.c
--- a/libexec/flua/modules/lposix.c
+++ b/libexec/flua/modules/lposix.c
@@ -165,6 +165,39 @@
}
+static int
+lua_dup2(lua_State *L)
+{
+ int error, oldd, newd;
+
+ enforce_max_args(L, 2);
+
+ oldd = luaL_checkinteger(L, 1);
+ if (oldd < 0) {
+ error = EBADF;
+ goto err;
+ }
+
+ newd = luaL_checkinteger(L, 2);
+ if (newd < 0) {
+ error = EBADF;
+ goto err;
+ }
+
+ error = dup2(oldd, newd);
+ if (error >= 0) {
+ lua_pushinteger(L, error);
+ return (1);
+ }
+
+ error = errno;
+err:
+ lua_pushnil(L);
+ lua_pushstring(L, strerror(error));
+ lua_pushinteger(L, error);
+ return (3);
+}
+
static int
lua_fnmatch(lua_State *L)
{
@@ -479,6 +512,7 @@
REG_SIMPLE(_exit),
REG_SIMPLE(chown),
REG_DEF(close, lua_pclose),
+ REG_SIMPLE(dup2),
REG_SIMPLE(fork),
REG_SIMPLE(getpid),
REG_SIMPLE(pipe),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 26, 9:36 PM (18 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30396892
Default Alt Text
D50176.id.diff (890 B)
Attached To
Mode
D50176: flua: add posix.unistd.dup2()
Attached
Detach File
Event Timeline
Log In to Comment