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 Date: Sun, 2 Apr 2000 22:19:13 -0400 From: Chris Faylor To: cygwin-developers AT sourceware DOT cygnus DOT com Cc: Corinna Vinschen Subject: Re: Permission denied with makeinfo from texinfo-4.0 Message-ID: <20000402221913.B25094@cygnus.com> Reply-To: cygwin-developers AT sourceware DOT cygnus DOT com Mail-Followup-To: Chris Faylor , cygwin-developers AT sourceware DOT cygnus DOT com, Corinna Vinschen References: <20000402204634 DOT D23469 AT cygnus DOT com> <200004030110 DOT UAA11749 AT hp2 DOT xraylith DOT wisc DOT edu> <20000402212045 DOT A24086 AT cygnus DOT com> <20000402221700 DOT A25094 AT cygnus DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.1.8i In-Reply-To: <20000402221700.A25094@cygnus.com>; from cgf@cygnus.com on Sun, Apr 02, 2000 at 10:17:00PM -0400 On Sun, Apr 02, 2000 at 10:17:00PM -0400, Chris Faylor wrote: >Corinna, do you want to take a shot at fixing this? I think the correct >place to do this is probably in fhandler_disk_file::read since you can't ^^^^^^^^^^^^^^^^^^^^^^^^ fhandler_base::read Sorry. There is no such routine as fhandler_disk_file::read, although maybe there should be so that we can eliminate the get_device test below and use subclassing instead. cgf >really determine the number of bytes remaining anywhere else, can you? > >Maybe to be safe we need a new fhandler method which can be triggered to >restart a read in the above scenario. So it would be something like: > > > In fhandler_base::read() > > if (!ReadFile (...) && GetLastError == ERROR_ACCESS_DENIED && > get_device () == FH_DISK) > return read_retry (in_ptr, in_len); > > New function: > int > fhandler_base::read_retry (void *in_ptr, size_t in_len) > { > DWORD lowpos, highpos, lowsize, highsize; > long long size, pos; > size_t left; > MEMORY_BASIC_INFORMATION in_ptr_info; > > lowsize = GetFileSize (get_io_handle (), &highsize); > if (lowsize == 0xffffffff && GetLastError () != NO_ERROR) > return -1; // need to preserve last GetLastError value > > highpos = 0; > lowpos = SetFilePointer (get_io_handle (), 0, &highpos, FILE_CURRENT); > if (lowpos == 0xffffffff && GetLastError () != NO_ERROR) > return -1; // need to preserve last GetLastError value > > size = ((long long) highsize) << 32 | lowsize; > pos = ((long long) highpos) << 32 | lowpos; > left = size - pos; // hopefully it fits > > (void) VirtualQuery (in_ptr + left - 1, &in_ptr_info, sizeof (in_ptr_info)); > if (in_ptr_info.AllocationProtect == PAGE_NOACCESS || > in_ptr_info.State == MEM_FREE) // not sure these are the correct things to check for > return -1; // need to etc. > return read (in_ptr, left); > } > >I think that is at least generally right, althought it is probably >full of typos.