From owner-freebsd-bugs Sun Nov 15 06:09:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA28163 for freebsd-bugs-outgoing; Sun, 15 Nov 1998 06:09:57 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA28158 for ; Sun, 15 Nov 1998 06:09:56 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id GAA21195; Sun, 15 Nov 1998 06:10:00 -0800 (PST) Date: Sun, 15 Nov 1998 06:10:00 -0800 (PST) Message-Id: <199811151410.GAA21195@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.ORG From: Arjan de Vet Subject: Re: bin/8518: freopen() in append mode followed by ftell() gives strange results Reply-To: Arjan de Vet Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/8518; it has been noted by GNATS. From: Arjan de Vet To: bde@zeta.org.au (Bruce Evans) Cc: Arjan.deVet@adv.iae.nl, freebsd-gnats-submit@FreeBSD.ORG, sthaug@nethelp.no Subject: Re: bin/8518: freopen() in append mode followed by ftell() gives strange results Date: Sun, 15 Nov 1998 15:03:00 +0100 (CET) Bruce Evans: >>Create empty /tmp/test file and run the program three times. Each >>time it will print 0 and 4. BSD/OS prints 0 4, 0 8 and 0 12. Solaris >>and Linux print 0 4, 4 8 and 8 12. > >The BSD/OS behaviour is the least surprising. The initial offsets >of zero may even be required (if no other process writes to the file). >POSIX.1 specifies fopen() to just use open(), and freopen() to do much >the same thing as fopen(). Therefore, the initial offsets at the file >descriptor level are zero, and for "a+" mode, an initial read would >start at the beginning of the file. Only the fuzzy specification of >permits the initial offsets at the stream level to be nonzero. But let's not look at the initial offset now but the offsets after writing 4 bytes. FreeBSD reports here three times '4' which looks completely wrong in my opinion: when you have "testtest" in a file and you append "test" ftell should say 12 isn't it? Arjan -- Arjan de Vet, Eindhoven, The Netherlands URL: http://www.iae.nl/users/devet/ for PGP key: finger devet@iae.nl To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message