From dd9e50923fa288d47fcf003fc35e318b77137839 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 14 Apr 2010 00:38:41 +0200 Subject: win32: ash: copyfd(): work around fcntl(F_DUPFD) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy --- shell/ash.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 007d501f9..3380e573e 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -5126,6 +5126,18 @@ copyfd(int from, int to) /*if (from != to)*/ newfd = dup2(from, to); } else { + if (ENABLE_PLATFORM_MINGW32) { + char* fds = ckmalloc(to); + int i,fd; + memset(fds,0,to); + while ((fd = dup(from)) < to && fd >= 0) + fds[fd] = 1; + for (i = 0;i < to;i ++) + if (fds[i]) + close(i); + free(fds); + return fd; + } newfd = fcntl(from, F_DUPFD, to); } if (newfd < 0) { -- cgit v1.2.3-55-g6feb