Re: fflush() on readonly files
From: Tim Robbins (tjr_at_freebsd.org)
Date: 06/19/04
- Previous message: Andrey Chernov: "Re: fflush() on readonly files"
- In reply to: Andrey Chernov: "Re: fflush() on readonly files"
- Next in thread: Andrey Chernov: "Re: fflush() on readonly files"
- Reply: Andrey Chernov: "Re: fflush() on readonly files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 19 Jun 2004 22:01:49 +1000 To: freebsd-arch@freebsd.org
On Sat, Jun 19, 2004 at 02:59:39PM +0400, Andrey Chernov wrote:
> On Sat, Jun 19, 2004 at 11:56:43AM +0200, Radim Kolar wrote:
> > Today I have stepped on another example: advancecomp (in ports):
> > 543 * Get the size of the file.
> > 544 */
> > 545 long fzsize(adv_fz* f)
> > 546 {
> > 547 if (f->type == fz_file) {
> > 548 struct stat st;
> > 549 if (fflush(f->f) != 0) {
> > 550 return -1;
> > 551 }
>
> This program relies on undocumented behaviour and should be fixed in
> anycase. Besides of that the only reasonable approach we can take is to do
> what majority of systems does here. Since you are interested in the
> subject, please post specific table for all main systems in the form
> like:
>
> System readonly fflush() behaviour
This has already been discussed:
- Microsoft libraries and other libraries imitating them discard buffered
input data (like fpurge().)
- UNIX libc (at least 7th ed.), Solaris libc, GNU libc and products derived
from P.J. Plauger's C library (e.g. QNX) do nothing and indicate success.
- BSD since Torek's stdio rewrite (inc. FreeBSD and Mac OS X) indicate
an error.
There is no reason to change from the perfectly correct & well-documented
behaviour BSD has had for 10-15 years. The original poster's example provides
a good argument for this: it detects application bugs.
Tim
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
- Previous message: Andrey Chernov: "Re: fflush() on readonly files"
- In reply to: Andrey Chernov: "Re: fflush() on readonly files"
- Next in thread: Andrey Chernov: "Re: fflush() on readonly files"
- Reply: Andrey Chernov: "Re: fflush() on readonly files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|