From owner-freebsd-standards@FreeBSD.ORG Sat Apr 4 14:56:45 2009 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34206106566B; Sat, 4 Apr 2009 14:56:45 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5000::149]) by mx1.freebsd.org (Postfix) with ESMTP id E8C4E8FC0A; Sat, 4 Apr 2009 14:56:44 +0000 (UTC) (envelope-from jilles@stack.nl) Received: by mx1.stack.nl (Postfix, from userid 65534) id 432513FB8F; Sat, 4 Apr 2009 16:56:44 +0200 (CEST) X-Spam-DCC: : X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on meestal-mk5.stack.nl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,FAKE_REPLY_C, NO_RELAYS autolearn=no version=3.2.3 X-Spam-Relay-Country: Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 791EF3FB8D; Sat, 4 Apr 2009 16:56:42 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id C9678228A2; Sat, 4 Apr 2009 16:56:29 +0200 (CEST) Date: Sat, 4 Apr 2009 16:56:29 +0200 From: Jilles Tjoelker To: bug-followup@FreeBSD.org, twschulz@trolltech.com, freebsd-standards@freebsd.org Message-ID: <20090404145629.GA31339@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Subject: Re: bin/108118: [libc] files should not cache their EOF status X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Apr 2009 14:56:45 -0000 The way I read POSIX, FreeBSD's current behaviour seems correct. Calling fread(3) is equivalent to calling fgetc(3) an appropriate number of times, and fgetc(3) shall fail if the end-of-file indicator is set for the stream, even if data is available on the underlying file. Apparently, POSIX aligns with the C standard here; System V tradition is not to check the end-of-file indicator here. Both src/lib/libc/stdio/refill.c (__srefill()) and Solaris fgetc(3) manpage agree about this. -- Jilles Tjoelker