Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com From: Chris Faylor Date: Sun, 2 Apr 2000 21:20:45 -0400 To: cygwin-developers AT sourceware DOT cygnus DOT com Subject: Re: Permission denied with makeinfo from texinfo-4.0 Message-ID: <20000402212045.A24086@cygnus.com> Reply-To: cygwin-developers AT sourceware DOT cygnus DOT com Mail-Followup-To: cgf AT cygnus DOT com, cygwin-developers AT sourceware DOT cygnus DOT com References: <20000402204634 DOT D23469 AT cygnus DOT com> <200004030110 DOT UAA11749 AT hp2 DOT xraylith DOT wisc DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.1.8i In-Reply-To: <200004030110.UAA11749@hp2.xraylith.wisc.edu>; from khan@NanoTech.Wisc.EDU on Sun, Apr 02, 2000 at 08:10:17PM -0500 On Sun, Apr 02, 2000 at 08:10:17PM -0500, Mumit Khan wrote: >Christopher Faylor writes: >> >> Are we sure that this is a correct analysis? The previous analysis was >> that ReadFile was being passed a length which was larger than its >> supplied buffer. That is (to me) inarguably wrong. You can't say "I >> know how big the file is" because you can *never* know how big the file >> is in a multi-tasking operating system. >> >> It seems like Dave Bryan went to some effort to track this down and I don't >> see that his analysis is incorrect. > >Dave's analysis is certainly correct, he's done a much more thorough >analysis of the situation. I had obviously neglected to read through >the entire thread, and missed some of the analysis. > >However, read IMO should not care whether I pass it a valid buffer or >not if it's at end of file, and should return success and 0 bytes read >instead. Doesn't excuse buggy code of course, but my reading of POSIX >`read' requires this behaviour. I can't see an easy fix for this behavior other than to detect an ERROR_ACCESS_DENIED in _read and then attempt to see if we're at EOF. In this case, we'd have to figure out how many bytes are actually left in the file and just pass that many to ReadFile. That could still fail, of course, but in that case, it would be a UNIX-type failure. cgf