X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Nh0sESmJfk/pi/7DrlQ+KK3rEVC9i1bvFAYoTkKoeBk=; b=ExNSXJAinDMc/c3kQZyOzF22qzZN00v1ga5EnpkbOeUIUVFDvjQVR4TlTeazQ3ztZZ bs8vjrVsr4kMgw7/n+d77fGU11aUwaA8mF8FbXindeDj1orGmiPddQxbK0ztzIBpN8y7 CLZypdXys7B0hC+8NvlRbH8HXeECSlmf/zbRxmpwTY1kpGWIHcyhxpzChCoO62rLgTR0 sGFEY5z2krJZvJPCzEIUhImM84zTfSfIvkcWowvsvcm/RXCu/vrClaqSO7r92ZNMW7zv VwTonfT8fSsg4jMO6MwHEFnQTLRB3VSnSKMjgUrA+f5/8gKoKryvYG6bayqR7Q6+iGug 91kw== MIME-Version: 1.0 X-Received: by 10.182.65.35 with SMTP id u3mr4025664obs.8.1374087066147; Wed, 17 Jul 2013 11:51:06 -0700 (PDT) In-Reply-To: <83y5951a79.fsf@gnu.org> References: <51E5D0C6 DOT 1060404 AT gmx DOT de> <83y5951a79 DOT fsf AT gnu DOT org> Date: Wed, 17 Jul 2013 13:51:06 -0500 Message-ID: Subject: Re: Set _IOERR if the file stream has been opened in wrong mode. From: Rugxulo To: djgpp-workers AT delorie DOT com Content-Type: text/plain; charset=ISO-8859-1 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Hi, On Wed, Jul 17, 2013 at 10:24 AM, Eli Zaretskii wrote: >> Date: Wed, 17 Jul 2013 01:01:26 +0200 >> From: Juan Manuel Guerrero >> >> The issue concerns the fread, fwrite, __putc and __getc functions only. >> These functions manipulate the file stream FILE *. Functions like read, >> _read and dos_read are not involved because they work with the file descriptor. >> If these functions fail due to accessing the file with wrong file mode, >> they set the appropriate dos error number. >> Of course, ferror can only fail for those functions that use the file stream. > > What standard mandates that reading from a file stream open in "w" > mode shall set the error flag for the stream? > > DJGPP currently sets the EOF flag, not the error flag. Why is that > wrong? Dunno, but OpenWatcom matches Linux here, surprisingly. But I'd still assume such (mis)use of "w" is undefined behavior.