diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-08-18 22:14:08 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-08-18 22:14:08 +0400 |
commit | 83eda97dffe6fa57b2908e1f18f488d9ba9071f9 (patch) | |
tree | 3be3e82e976e7b58b13b9b266f1d84c188b8b54f /winsup/cygwin | |
parent | 1c75dc93c8e26e4018a76e47d9328c078a70a188 (diff) |
* dtable.cc (dtable::dup2): Extend fdtab if newfd is out of current
allocated bounds.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cf952231a..51d9bc5df 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 18 11:11:00 2000 Corinna Vinschen <corinna@vinschen.de> + + * dtable.cc (dtable::dup2): Extend fdtab if newfd is out of current + allocated bounds. + Sat Aug 12 01:47:28 2000 Christopher Faylor <cgf@cygnus.com> * mkvers.sh: Properly trap exit removal of temp file. Remove debugging diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 716770ae8..9f0c2a047 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -345,6 +345,12 @@ dtable::dup2 (int oldfd, int newfd) } SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK,"dup"); + if ((size_t) newfd >= fdtab.size) + { + int inc_size = NOFILE_INCR * ((newfd + NOFILE_INCR - 1) / NOFILE_INCR) - + fdtab.size; + fdtab.extend (inc_size); + } if ((size_t) newfd >= fdtab.size || newfd < 0) { syscall_printf ("new fd out of bounds: %d", newfd); |