* dtable.cc (dtable::dup2): Extend fdtab if newfd is out of current

allocated bounds.
This commit is contained in:
Corinna Vinschen 2000-08-18 18:14:08 +00:00
parent 1c75dc93c8
commit 83eda97dff
2 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -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);