aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 00:38:41 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-20 19:14:41 +0200
commitdd9e50923fa288d47fcf003fc35e318b77137839 (patch)
tree447324caff20bfb6c664930f5f993676e1fe0126 /shell
parent377e7c3417a1a46035efd9aeb9875070ea452f5c (diff)
downloadbusybox-w32-dd9e50923fa288d47fcf003fc35e318b77137839.tar.gz
busybox-w32-dd9e50923fa288d47fcf003fc35e318b77137839.tar.bz2
busybox-w32-dd9e50923fa288d47fcf003fc35e318b77137839.zip
win32: ash: copyfd(): work around fcntl(F_DUPFD)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c12
1 files changed, 12 insertions, 0 deletions
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)
5126 /*if (from != to)*/ 5126 /*if (from != to)*/
5127 newfd = dup2(from, to); 5127 newfd = dup2(from, to);
5128 } else { 5128 } else {
5129 if (ENABLE_PLATFORM_MINGW32) {
5130 char* fds = ckmalloc(to);
5131 int i,fd;
5132 memset(fds,0,to);
5133 while ((fd = dup(from)) < to && fd >= 0)
5134 fds[fd] = 1;
5135 for (i = 0;i < to;i ++)
5136 if (fds[i])
5137 close(i);
5138 free(fds);
5139 return fd;
5140 }
5129 newfd = fcntl(from, F_DUPFD, to); 5141 newfd = fcntl(from, F_DUPFD, to);
5130 } 5142 }
5131 if (newfd < 0) { 5143 if (newfd < 0) {