diff options
author | Ron Yorston <rmy@pobox.com> | 2012-04-03 15:41:32 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-04-03 15:41:32 +0100 |
commit | 6a82920046979ff373ec55b1ace6e542c8cb13f5 (patch) | |
tree | 67137494e1b45940ce1ae6a348e68e56135bbad2 /shell | |
parent | d0b801b9459f48a6dd5446fb77070639b8c1462b (diff) | |
download | busybox-w32-6a82920046979ff373ec55b1ace6e542c8cb13f5.tar.gz busybox-w32-6a82920046979ff373ec55b1ace6e542c8cb13f5.tar.bz2 busybox-w32-6a82920046979ff373ec55b1ace6e542c8cb13f5.zip |
Make fake fcntl(F_DUPFD) for WIN32
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 18 |
1 files changed, 3 insertions, 15 deletions
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 | |||
950 | opentrace(void) | 950 | opentrace(void) |
951 | { | 951 | { |
952 | char s[100]; | 952 | char s[100]; |
953 | #if defined(O_APPEND) && !ENABLE_PLATFORM_MINGW32 | 953 | #ifdef O_APPEND |
954 | int flags; | 954 | int flags; |
955 | #endif | 955 | #endif |
956 | 956 | ||
@@ -975,7 +975,7 @@ opentrace(void) | |||
975 | return; | 975 | return; |
976 | } | 976 | } |
977 | } | 977 | } |
978 | #if defined(O_APPEND) && !ENABLE_PLATFORM_MINGW32 | 978 | #ifdef O_APPEND |
979 | flags = fcntl(fileno(tracefile), F_GETFL); | 979 | flags = fcntl(fileno(tracefile), F_GETFL); |
980 | if (flags >= 0) | 980 | if (flags >= 0) |
981 | fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND); | 981 | fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND); |
@@ -3904,7 +3904,7 @@ setjobctl(int on) | |||
3904 | if (--fd < 0) | 3904 | if (--fd < 0) |
3905 | goto out; | 3905 | goto out; |
3906 | } | 3906 | } |
3907 | fd = copyfd(fd, 10); | 3907 | fd = fcntl(fd, F_DUPFD, 10); |
3908 | if (ofd >= 0) | 3908 | if (ofd >= 0) |
3909 | close(ofd); | 3909 | close(ofd); |
3910 | if (fd < 0) | 3910 | if (fd < 0) |
@@ -5506,18 +5506,6 @@ copyfd(int from, int to) | |||
5506 | /*if (from != to)*/ | 5506 | /*if (from != to)*/ |
5507 | newfd = dup2(from, to); | 5507 | newfd = dup2(from, to); |
5508 | } else { | 5508 | } else { |
5509 | if (ENABLE_PLATFORM_MINGW32) { | ||
5510 | char* fds = ckmalloc(to); | ||
5511 | int i,fd; | ||
5512 | memset(fds,0,to); | ||
5513 | while ((fd = dup(from)) < to && fd >= 0) | ||
5514 | fds[fd] = 1; | ||
5515 | for (i = 0;i < to;i ++) | ||
5516 | if (fds[i]) | ||
5517 | close(i); | ||
5518 | free(fds); | ||
5519 | return fd; | ||
5520 | } | ||
5521 | newfd = fcntl(from, F_DUPFD, to); | 5509 | newfd = fcntl(from, F_DUPFD, to); |
5522 | } | 5510 | } |
5523 | if (newfd < 0) { | 5511 | if (newfd < 0) { |