From 6a82920046979ff373ec55b1ace6e542c8cb13f5 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 3 Apr 2012 15:41:32 +0100 Subject: Make fake fcntl(F_DUPFD) for WIN32 --- shell/ash.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 68d39c1f3..4766af34a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -950,7 +950,7 @@ static void opentrace(void) { char s[100]; -#if defined(O_APPEND) && !ENABLE_PLATFORM_MINGW32 +#ifdef O_APPEND int flags; #endif @@ -975,7 +975,7 @@ opentrace(void) return; } } -#if defined(O_APPEND) && !ENABLE_PLATFORM_MINGW32 +#ifdef O_APPEND flags = fcntl(fileno(tracefile), F_GETFL); if (flags >= 0) fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND); @@ -3904,7 +3904,7 @@ setjobctl(int on) if (--fd < 0) goto out; } - fd = copyfd(fd, 10); + fd = fcntl(fd, F_DUPFD, 10); if (ofd >= 0) close(ofd); if (fd < 0) @@ -5506,18 +5506,6 @@ 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