Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Richard Henderson <rth@dot.cygnus.com>
To: axp-list@redhat.com, Quant-X Alpha Linux Support <support@quant-x.com>
Cc: redhat-devel-list@redhat.com
Subject: Re: fclose() - still broken?
Date: Thu, 20 Aug 1998 00:33:24 -0700	[thread overview]
Message-ID: <19980820003324.G11405@dot.cygnus.com> (raw)
In-Reply-To: <19980820121206.A418@caffeine.ix.net.nz>; from Chris Wedgwood on Thu, Aug 20, 1998 at 12:12:06PM +1200

On Thu, Aug 20, 1998 at 12:12:06PM +1200, Chris Wedgwood wrote:
> >   rc = read(0, NULL, 10);
> > 
> >   returns 6 here (Linux 2.1.113 i586) (no errno, no core) 
> >   when entering "hello<CR>"
> > 
> > Is this valid, or not ? ;-0

Yes, but...

> A stickier question is what happens you you try to read a 10 byte
> file using read(fd,&buffer,8192) when the buffer is only 4k is size.
> 
> 2.0.x will return EFAULT because it knows the entire range is not
> valid (the high 4k is bad), but 2.1.x will succeed because it can
> read 10 bytes without failing.
> 
> Which is correct? (Btw, different OSs take one or other approach).

Both are correct, as you are walking in areas that are
officially undefined. 

As surprising as it might be, it is not required that a
system detect and return EFAULT.  I personally feel that
it is a quality of implementation detail that we do so.
It would also be interesting to send SIGSEGV instead and
find out how many programs are buggy.

Unfortunately, not all of the code rearrangements that 
are necessary to propogate back EFAULT were done, and so
will now have to be delayed until 2.3.


r~


  reply	other threads:[~1998-08-20  7:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m0z8jmQ-000aNFC@the-village.bc.nu>
1998-08-18 10:48 ` fclose() - still broken? Uncle George
1998-08-19  2:00   ` Chris Wedgwood
1998-08-19  2:50     ` Quant-X Alpha Linux Support
1998-08-19 12:04       ` Uncle George
1998-08-19 12:00         ` David Alan Gilbert
1998-08-20  0:12       ` Chris Wedgwood
1998-08-20  7:33         ` Richard Henderson [this message]
1998-08-18 10:19 Uncle George
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox