delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/04/03/13:36:13

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
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 <cgf AT cygnus DOT com>
Date: Mon, 3 Apr 2000 13:35:46 -0400
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: Permission denied with makeinfo from texinfo-4.0
Message-ID: <20000403133546.C1678@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> <20000402212045 DOT A24086 AT cygnus DOT com> <20000402221700 DOT A25094 AT cygnus DOT com> <38E89EB5 DOT 65FC1A41 AT vinschen DOT de>
Mime-Version: 1.0
User-Agent: Mutt/1.1.8i
In-Reply-To: <38E89EB5.65FC1A41@vinschen.de>; from corinna@vinschen.de on Mon, Apr 03, 2000 at 03:37:57PM +0200
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id NAA24003

On Mon, Apr 03, 2000 at 03:37:57PM +0200, Corinna Vinschen wrote:
>=== SNIP ===
>#include <sys/types.h> etcetera...
>...
>int
>main(int argc, char** argv)
>{
>  int fd;
>  char buf1[64000];
>  ssize_t bytes;
>
>  if ((fd = open (argv[1] ? argv[1] : argv[0], O_RDONLY)) < 0)
>    return 0;
>  lseek (fd, (off_t) 0, SEEK_END);
>  bytes = read (fd, buf1 + 64000, 40000);
>  printf ("read: %d, err: %d, %s\n", bytes, errno, strerror(errno));
>  close (fd);
>  return 0;
>}
>=== SNAP ===
>
>and the message is
>
>read: -1, err: 14, Bad address       <=== EFAULT!
>
>as it's currently under cygwin, too, and it _is_ an UNIX-style error.
>This is documented in the linux read(2) man page as well.
>
>So, if this behaviour is the same in a "reference os", where is
>the problem??? Well, uhm, I have no copy of POSIX, obviously...

That's not quite the same thing.  The behavior as I understand it is
something like this:

#include <sys/types.h> etcetera...
...
int
main(int argc, char** argv)
{ 
  int fd;
  char buf1[64000];
  ssize_t bytes;

  if ((fd = open (argv[1] ? argv[1] : argv[0], O_RDONLY)) < 0)
    return 0;
  lseek (fd, (off_t) -2, SEEK_END);
  bytes = read (fd, buf1 + (64000 - 2), 40000);
  printf ("read: %d, err: %d, %s\n", bytes, errno, strerror(errno));
  close (fd);
  return 0;
}

This supposedly works on UNIX and fails on Cygwin.

cgf

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019