This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Permission denied with makeinfo from texinfo-4.0


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]