summaryrefslogtreecommitdiff
path: root/libbb/xfuncs.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-03-25 23:21:05 +0000
committerDenis Vlasenko2007-03-25 23:21:05 +0000
commitcad04ef4f3435e56181a81c896912543be34ea3c (patch)
tree71e46e02914c97077eaa77e12a726b29240b27f6 /libbb/xfuncs.c
parent10f8f5f4433a88b9cf9048d38a45838aa6e2abf6 (diff)
downloadbusybox-cad04ef4f3435e56181a81c896912543be34ea3c.zip
busybox-cad04ef4f3435e56181a81c896912543be34ea3c.tar.gz
add NOMMU fixme's; move move_fd from runit_lib to libbb; nuke fd_copy
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r--libbb/xfuncs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index c496f9a..1dcdbc0 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -133,6 +133,16 @@ int ndelay_off(int fd)
return fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0) & ~O_NONBLOCK);
}
+// "Renumber" opened fd
+void xmove_fd(int from, int to)
+{
+ if (from == to)
+ return;
+ if (dup2(from, to) != to)
+ bb_perror_msg_and_die("cannot duplicate file descriptor");
+ close(from);
+}
+
// Die with an error message if we can't write the entire buffer.
void xwrite(int fd, const void *buf, size_t count)
{