This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fix off-by-one in dup2


On Dec  4 12:36, Corinna Vinschen wrote:
> On Dec  4 10:32, Corinna Vinschen wrote:
> > Hi guys,
> > [...etc...]
> > The problem is still present in the current sources.
> > [...]

Ouch, ouch, ouch!  I tested the wrong DLL.  Actually current CVS fixes
this problem.  Duh.  Sorry for the confusion.

One question, though.  Assuming start is == size, then the current code
in CVS extends the fd table by only 1.  If that happens often, the
current code would have to call ccalloc/memcpy/cfree a lot.  Wouldn't
it in fact be better to extend always by at least NOFILE_INCR, and to
extend by (1 + start - size) only if start is > size + NOFILE_INCR?
Something like

  size_t extendby = (start >= size + NOFILE_INCR) ? 1 + start - size : NOFILE_INCR;

?

Sorry again.  Fortunately it's my WJM week...


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpE9pMuuD20t.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]