From 377526f2266c1473e0c699408c59a269c839263a Mon Sep 17 00:00:00 2001 From: vda Date: Sun, 25 Mar 2007 23:21:05 +0000 Subject: add NOMMU fixme's; move move_fd from runit_lib to libbb; nuke fd_copy git-svn-id: svn://busybox.net/trunk/busybox@18237 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- libbb/xfuncs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libbb') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index c496f9a22..1dcdbc065 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) { -- cgit v1.2.3-55-g6feb