Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152898772
D50176.id155331.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.id155331.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
Sat, Apr 18, 9:35 PM (10 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31734420
Default Alt Text
D50176.id155331.diff (890 B)
Attached To
Mode
D50176: flua: add posix.unistd.dup2()
Attached
Detach File
Event Timeline
Log In to Comment