diff options
author | Christopher Faylor <me@cgf.cx> | 2013-12-04 17:55:17 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2013-12-04 17:55:17 +0000 |
commit | 9915ebec8a20b9fccd8459c6a5a63c08d1fae635 (patch) | |
tree | 1cbf910ee38e33d1c19e649bbe6a2e88111b2903 /winsup | |
parent | 6b5a3418781738deaa0a87f4c93fa4c50f5fe050 (diff) | |
download | newlib-9915ebec8a20b9fccd8459c6a5a63c08d1fae635.zip newlib-9915ebec8a20b9fccd8459c6a5a63c08d1fae635.tar.gz newlib-9915ebec8a20b9fccd8459c6a5a63c08d1fae635.tar.bz2 |
* dtable.cc (dtable::find_unused_handle): When extending, always make sure that
there is a NOFILE_INCR chunk following the free fd.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 89dce26..490a7d6 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2013-12-04 Christopher Faylor <me.cygwin2013@cgf.cx> + + * dtable.cc (dtable::find_unused_handle): When extending, always make + sure that there is a NOFILE_INCR chunk following the free fd. + 2013-12-03 Christopher Faylor <me.cygwin2013@cgf.cx> * select.cc (select): Add workaround for, as yet undebugged, diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index e97966b..4547984 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -223,7 +223,9 @@ dtable::delete_archetype (fhandler_base *fh) int dtable::find_unused_handle (size_t start) { - size_t extendby = (start >= size) ? 1 + start - size : NOFILE_INCR; + /* When extending, always make sure that there is a NOFILE_INCR chunk + following the empty fd. */ + size_t extendby = NOFILE_INCR + ((start >= size) ? 1 + start - size : 0); /* This do loop should only ever execute twice. */ int res = -1; |