From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21066 invoked by alias); 15 Jul 2005 07:26:17 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 21002 invoked by uid 22791); 15 Jul 2005 07:26:01 -0000 Received: from gecko.sbs.de (HELO gecko.sbs.de) (194.138.37.40) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 15 Jul 2005 07:26:01 +0000 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.12.6/8.12.6) with ESMTP id j6F7OYxL010353; Fri, 15 Jul 2005 09:24:34 +0200 Received: from fthw9xpa.ww002.siemens.net (fthw9xpa.ww002.siemens.net [157.163.133.222]) by mail2.sbs.de (8.12.6/8.12.6) with ESMTP id j6F7OXs9004512; Fri, 15 Jul 2005 09:24:33 +0200 Received: from MCHP7IEA.ww002.siemens.net ([139.25.131.146]) by fthw9xpa.ww002.siemens.net with Microsoft SMTPSVC(6.0.3790.0); Fri, 15 Jul 2005 09:27:58 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: bug in freopen Date: Fri, 15 Jul 2005 07:26:00 -0000 Message-ID: From: "Schwarz, Konrad" To: "Eric Blake" , , X-SW-Source: 2005-07/txt/msg00723.txt.bz2 > -----Original Message----- > From: newlib-owner@sources.redhat.com=20 > [mailto:newlib-owner@sources.redhat.com] On Behalf Of Eric Blake > Sent: Friday, July 15, 2005 1:14 AM > To: cygwin@cygwin.com; newlib@sourceware.org > Subject: bug in freopen >=20 > POSIX requires that freopen(NULL, mode, f) reopen f in the=20 > new mode, and allows implementations the option of not even=20 > closing f in the first place. But in cygwin, it is failing=20 > with EFAULT, which is not even one of the errors allowed by POSIX. >=20 > http://www.opengroup.org/susv3xsh/freopen.html Just to be pedantic: POSIX allows system interfaces to set to values additional to those documented in the standard, so this in itself is not necessarily a bug. Of course, freopen() should not be calling open() with NULL, it appears this case has not been implemented in newlib.=20 >=20 > #include > #include > int main(void) > { > FILE* f =3D freopen (NULL, "rb", stdin); /* Ensure that=20 > stdin is binary */ > printf ("file is %s, errno %d:%s\n", f ? "good" : "null", errno, > strerror(errno)); > return 0; > } >=20 > CVS coreutils recently switched to this idiom, replacing its=20 > former use of the nonstandard and setmode() with=20 > something that is required by the standards. But until this=20 > bug is fixed, CVS coreutils will not work with cygwin. The=20 > strace in cygwin shows that newlib tried to perform=20 > open(NULL), which is the cause of the EFAULT. >=20 > -- > Eric Blake >=20 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/