delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/02/20/02:29:58

Date: Thu, 20 Feb 1997 09:15:37 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "John M. Aldrich" <fighteer AT cs DOT com>
cc: DJGPP Workers Mailing List <djgpp-workers AT delorie DOT com>,
"Vyacheslav O. Myskin" <V DOT O DOT Myskin AT inp DOT nsk DOT su>, djgpp AT delorie DOT com
Subject: Re: Starnge rm behavour
In-Reply-To: <330BE113.5328@cs.com>
Message-ID: <Pine.SUN.3.91.970220091021.25071M-100000@is>
MIME-Version: 1.0

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019