Date: Thu, 20 Feb 1997 09:15:37 +0200 (IST) From: Eli Zaretskii To: "John M. Aldrich" cc: DJGPP Workers Mailing List , "Vyacheslav O. Myskin" , djgpp AT delorie DOT com Subject: Re: Starnge rm behavour In-Reply-To: <330BE113.5328@cs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 19 Feb 1997, John M. Aldrich wrote: > out okay with the original 'rm' bug, but I'm worried that the technique > I use would be vulnerable to crashes with extremely long command lines. > Should I use more than 4096 bytes for the buffer? It's hard to imagine > a command line to redir being longer than 51 screen lines, and I don't > want to use too much extra memory, but odder things have happened... Since the default DJGPP transfer buffer is 16K, and can be as large as 64K, 4K is too restrictive. Imagine somebody who needs to redirect the output of ld while linking a large package. So if you want to go for simplicity and use a fixed size, make it 65535. A better solution would be to malloc an initial size, then realloc it when it is exhausted. And btw, I think `redir' should be built with transfer buffer of 64K, so that it never fails a program due to insufficient space there. If `redir' has 64K transfer buffer, you can just malloc a 64K-long buffer and never bother to realloc.