The following code in find_and_load (makeinfo/files.c) appears to need
an overhaul. See [PM] for the changes I did to make it work on Cygwin
1.0. without these changes makeinfo complains about 'Permission
denied' for any file.

char * find_and_load (filename):

  ...
  /* [PM] On cygwin 1.0 O_BINARY appears to be defined. However, the
     number of bytes read is (may be?) the same as the file_size. The
     original code assumed that the number of bytes read where
     strictly less than file_size. I changed the size test to be
     inclusive, causing an unnecessary xrealloc instead of an error.

     Note: The while loops below happily pass an incorrect buffer size 
     in all but the first call to read. Not good.
  */

  /* VMS stat lies about the st_size value.  The actual number of
     readable bytes is always less than this value.  The arcane
     mysteries of VMS/RMS are too much to probe, so this hack
    suffices to make things work. */
#if O_BINARY || defined (VMS)
#ifdef VMS
  while ((n = read (file, result + count, file_size)) > 0)
#else  /* !VMS */
#ifndef WIN32
  while ((n = read (file, result + count, file_size)) > 0)
#else /* WIN32 */
  /* Does WIN32 really need reading 1 character at a time??  */
  while ((n = read (file, result + count, 1)) > 0)
#endif /* WIN32 */
#endif /* !VMS */
    count += n;
  /* [PM] changed from count < file_size to count <= file_size */
  if (0 < count && count <= file_size)
    result = xrealloc (result, count + 2); /* why waste the slack? */
  else if (n == -1)
#else /* !VMS && !O_BINARY */
    count = file_size;
    if (read (file, result, file_size) != file_size)
#endif /* !VMS && !WIN32 */
   ...

Reply via email to