Date: Tue, 8 Jul 1997 19:07:31 -0400 (EDT) Message-Id: <199707082307.TAA02559@delorie.com> From: DJ Delorie To: crough45 AT amc DOT de CC: djgpp AT delorie DOT com In-reply-to: <97Jul8.164038gmt+0100.16641@internet01.amc.de> (message from Christopher Croughton on Tue, 8 Jul 1997 15:44:50 +0100) Subject: Re: interesting redir behavior Precedence: bulk > > DJ should answer that. But AFAIK, the way `redir' works is quite common > > practice; I've seen many programs doing that, and OpenDOS will break all > > of them. For example, Less is one of them. > > Hmm. I've always viewed that as potentially dangerous behaviour, because > I've don't remember any O/S specification which guarantees that an open > always gets the lowest available file descriptor. Relying on undocumented POSIX 1003.1 Sec 5.3.1.2 states: The open() function shall return a file descriptor for the named file that is the lowest file descriptor not currently open for that process. POSIX 1003.1 Sec 5.3.1.3 states: Upon successful completion, the function shall open the file and return a nonnegative integer representing the lowest numbered unused file descriptor.